Skip to content

feat(acp): chat agents can declare a managed runtime that a start runs but never installs - #28460

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/agy-chat-2-managed-runtime
Oct 15, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/agy-chat-2-managed-runtime

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​86 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​85
Prod 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​266 $\color{#cf222e}{\Huge{\mathbf{−}}}$​25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​241

ELI5

Antigravity's chat needs a separate program, its chat server, which Orca downloads for it (100–330 MB). When chats fetched that program on their own, the first chat sat on "Working for Ns" for about 18 seconds with no progress and no way to cancel, and opening several chats started several downloads.

This stack changes that: nothing downloads until the person clicks Install, which shows progress and a Cancel button in Settings and in the chat itself, and the chat can't be used until the program is installed.

This PR is the first piece. An agent can now declare a program that Orca keeps for it. Starting a chat runs an installed copy if there is one, but never downloads. With no copy, the start is refused with a clear message.

What Changed

  • Before: an Agent Client Protocol (ACP) chat agent ran only from its Command setting, from PATH, or from its own install folders. Nothing could declare a program Orca provides.
  • After: an ACP launch spec may declare managedRuntime (label, root(dataDirectory), pin()): where Orca keeps the agent's releases on this host, and which release this host should have (version, download URL, archive SHA-256, and each file's SHA-256 and size). The type has no download method, so no launch path can install.
    • Lookup order: the person's Command setting, then Orca's installed release, then PATH and the agent's install folders. A copy found there runs only when every file the release needs sits beside it (for Antigravity, the server and its helper), so a lone server file is never started. Agents without a managed runtime keep today's order exactly.
    • Among Orca's releases, a start runs the pinned version when it is complete, otherwise the newest other complete one.
    • "Complete" is checked cheaply on every lookup. Each release folder holds a small receipt (.install-complete.json, written before the folder is moved into place) naming the release, its platform and architecture, and each file's size. Each file must exist, be a regular file of that size, and be executable (the executable check is skipped on Windows). Full hashes are only taken by the installer (feat(acp): a managed runtime installs only when asked, with progress and cancel #29023).
    • A missing file or a mismatch counts as broken. A read error other than "missing" (a disk or file-handle error, say) is reported separately as unreadable, so cleanup in feat(acp): a managed runtime installs only when asked, with progress and cancel #29023 skips instead of deleting a working copy. A launch treats both as not installed.
    • A start that finds nothing refuses before spawning, with a new reason runtimeNotInstalled: "{agent} isn't installed on the computer running this chat. Install it from the chat in a current version of Orca." It uses the existing refusal fields, so older apps show the same text. All 6 languages.
    • Orca's data folder is now a required input of the ACP launch resolver and the model-catalog probe, so a probe finds the installed release too (and, like a start, never downloads).
  • Merged alone: nothing visible changes. No agent declares a managed runtime until feat(acp): Antigravity in the Chat UI over its ACP server #28595 (adds Antigravity to chat).

Why

Downloading inside the launch path is the one fact behind the silent download, the duplicate downloads, the missing progress and cancel, and a damaged folder that nothing could repair. Removing the download from the launch API itself (not just from one caller) means no chat start, sign-in, settings read or model probe can trigger it.

The receipt check replaces "the folder exists" because a folder can lose a file after it was published. Hashing hundreds of megabytes on every launch would be too slow, so the size, type and executable check is the cheap middle ground.

The refusal text points at the chat, not at this computer's Settings, because a chat on a paired host needs the program installed on that host, and an older app that shows only this text still needs to know where to go.

Linked Issue

N/A (maintainer; part of the stack that adds Antigravity to chat).

Visual Proof

N/A: no agent declares a managed runtime yet, so nothing visible changes in this PR.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • One test drives a real adapter start through the real launch resolver: nothing installed → refused with runtimeNotInstalled; a lone server file in the agent's install folder → still refused; a complete release → spawns it, even with a complete copy in the install folder; that release damaged → the complete install-folder copy runs.

  • Lint and typecheck: PR CI.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH / remote: the lookup runs on the host that runs the agent, against that host's data folder. Folder workspaces are unaffected.
  • Windows: the executable-bit check is skipped there; no agent has a Windows release in this stack.
  • Mixed versions: the new refusal reason is additive; an older client reads the existing message field.
  • Stack: bottom PR, based on main. feat(acp): chat agents can run with their own temp folder, cleared when they exit #28462 (private temp folder per agent process) builds on it.
  • PR author: @BrennanKB5

Differences from the common pattern

  • Intended: the release a launch runs is derived from the release folders on disk (the pinned one, else the newest whole one) rather than a separate "active" pointer file; each folder's completion receipt carries the release's archive hash, so identity is still checked.
  • Intended: the platform and architecture are recorded in the completion receipt and checked on read, instead of being part of the folder path.
  • Intended: if the pinned release is damaged, a launch runs an older whole release when one exists instead of failing; the status read reports the damaged folder.
  • Intended: the "not installed" launch refusal is one sentence for every host; it is a safety net, because the Install control is offered only on hosts with a published release.
  • Intended: a copy found on PATH or in the agent's install folders is checked for its companion files by name, type and executable bit, not by size, because it can be any release the person installed themselves.
  • Intended: a Command setting is used as set, without the companion-file check; no agent with a managed runtime honours it (Antigravity chats ignore it, feat(acp): Antigravity in the Chat UI over its ACP server #28595).

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Some chat agents need a program the user has not installed, so their first start currently fails. This PR adds an optional verified copy installed during the existing chat loading state. No agent opts in yet, so current chat behavior is unchanged.

Review stopped at round 3 pending Brennan’s decision. I pushed 326badf4f10 to make all existing install locations win over the managed copy; the real-resolver regression test failed before that fix and passes after it. A later narrow check found one P2 caused by that fix: a Command setting that names an already-installed managed executable without a path is now rejected before its folder is searched. It worked on the original PR; an absolute path still works. The architecture rerun recommends keeping host-owned start preparation and verified atomic publication, and correcting only the agent command lookup by retrying a failed Command search against the managed folder. No further fix or round 4 has started.

Deferred temporary P2 gap: if a published runtime folder loses its launcher but retains other files, retrying start cannot repair it. A separate approved follow-up will publish repairs beside the damaged version without deleting files a running agent may use. Catalog access to managed copies and duplicate concurrent first downloads remain deferred until a provider needs them.

Verified locally on macOS: 929 affected tests before the fix, all 613 chat-agent tests afterward, Node typecheck, changed code quality, and a scratch comparison confirming the Command regression. The diff adds 161 production lines and 93 test lines, within the budgets. Local orca-ci-checks failed only on the documented Bun 1.3.14 versus pinned 1.4.3 limitation; CI static analysis/typecheck passed, along with guards, line count, both package checks, relay integration and the other observed Node shards.

CI is not green: Node shard 3 failed because the unchanged transcript-watch-liveness.test.ts parent-directory replacement case timed out waiting for an append. No PR-causal link was observed, but the precise cause is unproven; no workflow was rerun. Failed job.

Electron QA is N/A because no provider uses the option yet. No live Windows, Linux, SSH or real provider start was exercised. No merge, restack, parent-branch edit or lockfile commit occurred.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Some chat agents need a program the user has not installed, so their first start currently fails. This PR adds an optional verified copy installed during the existing chat loading state, before the agent starts. No agent enables the option yet, so current chat behavior is unchanged.

Review complete at 326badf4f10; final readiness found no new blocking defect and CI is green. This supersedes the earlier comment that stopped pending Brennan's decision. Brennan decided no further code change: an explicit Command setting always selects the user's installation. A bare Command absent from PATH and the usual install folders is refused; it does not fall back to Orca's private copy. Automatic use of that copy applies when no Command is set. The round-3 question is resolved as intended behavior, and the review remains at three rounds.

Fixed: user-installed programs, including the usual fallback folders, now take priority over a managed copy. The regression test failed before this lookup fix and passed afterward. Deferred P2: retrying start cannot repair a nonempty runtime folder that has lost its launcher. The approved follow-up will publish repairs beside the damaged version without deleting files a running agent may use. Catalog access to managed copies and avoiding duplicate concurrent first downloads also remain deferred until a provider needs them.

Verified: final source readiness and a dedicated performance pass; prior local results of 929 affected tests before the fix, all 613 chat-agent tests afterward, Node typecheck, and changed-code quality. CI now passes static analysis/typecheck, all five Node test shards, relay integration, both package checks, repository guards, line count and aggregate verification. The earlier transcript-watch-liveness timeout passed on rerun. Local orca-ci-checks retains the documented Bun 1.3.14 versus pinned 1.4.3 tooling failure; CI passed with pinned tooling. No tests were repeated on unchanged code in this resume.

Electron QA and screenshots are N/A because no provider uses the option yet. No live Windows, Linux, SSH, mobile or real provider start was exercised. No code change, push, restack, parent/child branch edit, lockfile commit or merge occurred during this resume. The PR remains unmerged.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 14, 2026 17:26
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/agy-chat-6-permission-mode to main October 14, 2026 17:32
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-2-managed-runtime branch from 326badf to cb90367 Compare October 14, 2026 17:32
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7214e373-b4a2-49ea-b0a5-828931754978
📥 Commits

Reviewing files that changed from the base of the PR and between f88b5de and cd3ba36.

📒 Files selected for processing: 3
  • src/main/acp/acp-structured-launch-resolution.ts
  • src/main/acp/acp-structured-managed-runtime.test.ts
  • src/main/node-runtime/managed-runtime-release.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

ACP launch specs can identify a managed runtime. Launch resolution checks installed runtime releases and selects an available matching executable or a complete local copy. Launch preparation returns a runtimeNotInstalled refusal when a configured managed runtime remains unresolved. Session failure handling and localized chat messages recognize that refusal.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to cd3ba

The reviewed launch behavior matches the tested lookup order, and no blocking issue remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 26 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: ACP chat agents can declare a managed runtime that launch does not install.
Description check Passed The description includes all required sections and clearly explains the user impact, implementation, rationale, testing, compatibility considerations, and checklist status. The missing issue link is e…
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments: 1
src/main/node-runtime/pinned-runtime-materializer.ts: 1

141-148: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Only chmod members in the staging folder, not in the published folder.

verifyMembers runs chmod(path, 0o755) on every member. The rename fallback at Line 156 also calls verifyMembers(folder), so it changes the permissions of a folder that another start already published. That folder may be in use. On POSIX, the extracted members already have mode bits, and the first publisher sets them before rename. Move the chmod step out of verifyMembers and run it only on extractedDir.

♻️ Proposed fix
   const verifyMembers = async (root: string): Promise<void> => {
     for (const member of runtime.members) {
       const path = join(root, ...member.path.split('/'))
       await verifyFileSha256(path, member.sha256, `${runtime.label} ${member.path}`)
-      if (process.platform !== 'win32') {
-        await chmod(path, 0o755)
-      }
     }
   }
   try {
     const extractedDir = await downloadAndExtract(runtime, paths, temporaryDir, options)
     await verifyMembers(extractedDir)
+    if (process.platform !== 'win32') {
+      for (const member of runtime.members) {
+        await chmod(join(extractedDir, ...member.path.split('/')), 0o755)
+      }
+    }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 346c448f-bbda-4987-b8d4-25babfc19e51
📥 Commits

Reviewing files that changed from the base of the PR and between 93baa82 and cb90367.

📒 Files selected for processing: 10
  • src/main/acp/acp-launch-specs.ts
  • src/main/acp/acp-structured-acquire.ts
  • src/main/acp/acp-structured-launch-preparation.ts
  • src/main/acp/acp-structured-launch-resolution.ts
  • src/main/acp/acp-structured-managed-runtime.test.ts
  • src/main/acp/acp-structured-session-adapter-deps.ts
  • src/main/node-runtime/pinned-runtime-materializer-folder.test.ts
  • src/main/node-runtime/pinned-runtime-materializer.ts
  • src/main/node-runtime/runtime-archive-download.ts
  • src/main/runtime/structured-agent-runtime-registrations.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@OrcaWin

OrcaWin commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

QA: first Antigravity chat start on a fresh profile (managed server download)

Built from brennanb2025/agy-chat-8-antigravity-row @ 7ebb0e6602 (stacks this PR's download code). Ran on an M4 MacBook Air (darwin-arm64) as a hidden dev app with a fresh profile and a throwaway home, and nobody signed in. Times are wall clock from the Send click.

First chat (server not installed yet)

Time What happened
before Managed folder <userData>/agent-runtimes/antigravity does not exist. Opening the chat does not start the download.
+0.4 s Download already started: .download-<pid>-<uuid>/agy-acp-server-1.3.0-darwin-arm64.zip at 1.6 MB
~+4.1 s (est.) Download done: archive 111,456,962 bytes, measured steady ~29.6 MB/s (28–31 MB/s per 1 s sample)
+4.9 → +7.4 s Unzip: agy_acp_server.par (278,535,456 B) and localharness_external (118,611,392 B)
+8.6 s Verified folder published as antigravity/1.3.0/, server process spawned
+17.4 s Server reports sign-in needed, chat ends (trace spawn_to_outcome_ms 8861)
+18.5 s Settled on screen

On screen: Working for Ns / Working… the whole time, with no download or install wording. It settled as Your message was not sent. + red notice Sign in to Antigravity. The agent asked to sign in in a browser. The sidebar shows Antigravity Chat - Failed. A macOS is blocking Orca notifications toast also appeared, because the dev app has no notification permission.

Second chat (same profile, already installed): no download (no staging folder appeared). The server spawned at send, showed Working for 2s, and the same sign-in notice arrived at +3.8 s (spawn_to_outcome_ms 3866).

The ~17 s first start splits roughly in half: ~8.6 s to download, unzip and verify, then ~8.9 s from server spawn to its sign-in answer (vs 3.9 s on the second start, so part of that is a first-run cost of the freshly installed server).

Notes:

  • Antigravity only appears in the new-tab menu when an agy CLI is found on PATH. With none installed it is missing, even though chats run the managed server. For this run I put a detection-only agy stub on the rig's PATH.
  • On a slow connection, the 111 MB download shows only a generic "Working…" for the whole wait.
  • The machine was heavily loaded (load average 90–117 from other work), which may inflate the server first-run time.
  1. Before send
    first start, before send
  2. During download (+0.7 s)
    first start, downloading
  3. Settled (+18.5 s)
    first start, settled
  4. Second chat, before send
    second start, before send
  5. Second chat, settled (+5.0 s)
    second start, settled

@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-2-managed-runtime branch from cb90367 to 2c93757 Compare October 15, 2026 06:08
@brennanb2025
brennanb2025 marked this pull request as draft October 15, 2026 06:08
@brennanb2025
brennanb2025 force-pushed the brennanb2025/agy-chat-2-managed-runtime branch 2 times, most recently from afbbbaf to 101a7d2 Compare October 15, 2026 06:18
@brennanb2025 brennanb2025 changed the title feat(acp): chat agents can declare a pinned runtime that installs on first chat start feat(acp): chat agents can declare a managed runtime that a start runs but never installs Oct 15, 2026
… but never installs

A start resolves PATH and the agent's install folders first, then the newest whole release under
Orca's data folder (its completion receipt and member sizes checked); with none it refuses with
runtimeNotInstalled instead of downloading.
…nd point a not-installed chat at the chat itself

A transient read error (EIO, EMFILE) no longer counts a working release as incomplete; only
definite absence or a mismatch does. The not-installed refusal no longer sends a remote chat's
user to this computer's Settings.
…, and a copy elsewhere only beside every file it needs
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