Skip to content

ACP implementation bringing 31 CLI tools into t3code#2684

Closed
LivioGama wants to merge 1 commit into
pingdotgg:mainfrom
LivioGama:feat/acp-registry
Closed

ACP implementation bringing 31 CLI tools into t3code#2684
LivioGama wants to merge 1 commit into
pingdotgg:mainfrom
LivioGama:feat/acp-registry

Conversation

@LivioGama

@LivioGama LivioGama commented May 14, 2026

Copy link
Copy Markdown

Demo

Watch the demo


Note

High Risk
Spawns and kills external agent processes, downloads and executes third-party binaries from registry URLs, and uses aggressive orphan reaping (SIGKILL by binary path prefix on Unix)—any mis-targeting or supply-chain issue could affect stability or security.

Overview
Adds end-to-end support for bundled ACP registry agents alongside the existing first-party providers, so users can install, authenticate, and chat with registry CLI tools from Settings → Providers.

On the server, a new AcpRegistryService handles list / install / uninstall / authenticate: installs persist in installs.json (with migration off legacy settings.json), binaries land under acpRegistryCacheDir, and npx/uvx/binary channels are resolved by installer.ts (download, optional SHA-256, archive extraction, spawn targets). Install/uninstall also auto-creates or removes providerInstances and blocks uninstall when active sessions exist. Four WebSocket RPC methods expose the flow to the client.

Each registry entry gets a data-driven AcpRegistryDriver wired into builtInDrivers, backed by AcpRegistryAdapterLayer (pooled ACP child processes, sessions, permissions, cwd-scoped FS) plus shared AcpConnection / AcpMultiSession. Boot-time model discovery caches models in the install manifest; orphan reaping and a child-process shutdown registry reduce leaked agent processes after restarts or hard kills. ACP permission replies now map to agent-advertised option IDs, and adapter errors avoid leaking transport secrets.

The web app adds registry icons, ACP-specific auth messaging in the status banner, and settings UI (AddOrInstallProviderPanel) for browsing and installing agents. Registry agents do not support auxiliary text generation in v1 (explicit errors for callers to fall back).

Reviewed by Cursor Bugbot for commit a9eeeef. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add ACP registry integration bringing 31 CLI agent tools into t3code as installable providers

  • Introduces a full ACP registry pipeline: a bundled registry.json snapshot with 31 agents, a sync-acp-registry script to refresh it, and SVG icons copied into the web app at build time via a Vite plugin.
  • Adds a new built-in driver per registry entry (AcpRegistryDriver) that manages install state, spawns agent processes, discovers models, reaps orphan processes on boot, and gates background discovery by prior failure count.
  • Adds AcpRegistryService exposing list, install, uninstall, and authenticate over WebSocket RPC, with per-distribution auth probe timeouts (4s binary, 25s npx/uvx).
  • Adds an inline "Add or Install Provider" panel in Settings (replacing the old dialog) that lets users browse registry agents, install/uninstall them, and configure provider instances with client-side validation.
  • Introduces child process tracking (childProcessRegistry) with SIGTERM/SIGKILL group reaping on server shutdown and an install manifest (installs.json) with automatic migration from legacy settings.
  • Risk: background model discovery and orphan reaping run at startup for all installed ACP agents, adding process spawning overhead proportional to the number of installed agents.
📊 Macroscope summarized a9eeeef. 45 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 95bdc4e5-d91d-4ddc-9fa8-f0db36c36cf1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels May 14, 2026
Comment thread apps/server/src/acpRegistry/installer.ts
Comment thread docs/providers/acp-registry.md Outdated
Comment thread apps/server/src/acpRegistry/installer.ts Outdated
@LivioGama LivioGama force-pushed the feat/acp-registry branch from 085f518 to ee86ab9 Compare May 14, 2026 08:57
Comment thread apps/server/src/acpRegistry/installer.ts
@LivioGama LivioGama force-pushed the feat/acp-registry branch 12 times, most recently from 9126d46 to 8c96e1e Compare May 18, 2026 05:16
Comment thread apps/server/src/provider/acp/AcpMultiSession.ts
Comment thread apps/server/src/acpRegistry/installManifest.ts
Comment thread apps/server/src/provider/Layers/acpRegistryAdapter/helpers.ts
@LivioGama LivioGama force-pushed the feat/acp-registry branch 2 times, most recently from c5c0bb4 to 3e1f7f9 Compare May 18, 2026 21:23
Comment thread apps/server/src/acpRegistry/AcpRegistryService.ts Outdated
@LivioGama LivioGama force-pushed the feat/acp-registry branch 2 times, most recently from 74107bf to 43441d2 Compare May 18, 2026 21:39
Comment thread scripts/sync-acp-registry.ts
@LivioGama LivioGama force-pushed the feat/acp-registry branch from 43441d2 to cd5e45c Compare May 18, 2026 22:34
@LivioGama LivioGama marked this pull request as ready for review May 18, 2026 22:40
Copilot AI review requested due to automatic review settings May 18, 2026 22:40

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds first-class support for bundling, installing, and running ACP Registry agents across contracts, server, and web UI, including install state persistence and authentication UX.

Changes:

  • Introduces ACP registry schemas/contracts, bundled registry snapshot access, and new WS/IPC RPCs for listing/install/uninstall/authenticate.
  • Implements server-side ACP registry install pipeline (binary/npx/uvx), install manifest migration/persistence, and a generic AcpRegistryDriver per bundled agent.
  • Updates web UI to surface registry agents inside Providers, add inline model picker UX, and render ACP agent icons.

Reviewed changes

Copilot reviewed 66 out of 101 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/sync-acp-registry.ts Adds a script to sync the upstream ACP registry snapshot and icons into contracts.
packages/shared/src/serverSettings.ts Ensures whole-map replacement semantics for acpRegistryInstalls patches.
packages/shared/src/serverSettings.test.ts Adds regression test for replacing acpRegistryInstalls entries.
packages/effect-acp/src/client.ts Adjusts JSON-RPC request id generation for JVM agent compatibility.
packages/contracts/src/settings.ts Adds ACP registry settings schema and server settings fields for install state.
packages/contracts/src/server.ts Extends server provider auth schema with ACP-advertised auth methods.
packages/contracts/src/rpc.ts Adds ACP registry WS RPC method contracts and wires them into the RPC group.
packages/contracts/src/registry/index.ts Exposes the bundled registry document and lookup helpers.
packages/contracts/src/registry/icons/vtcode.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/stakpak.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/sigit.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/qwen-code.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/qoder.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/poolside.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/pi-acp.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/opencode.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/nova.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/mistral-vibe.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/minion-code.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/kimi.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/kilo.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/junie.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/goose.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/glm-acp-agent.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/github-copilot-cli.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/gemini.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/factory-droid.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/dirac.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/dimcode.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/deepagents.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/cursor.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/crow-cli.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/corust-agent.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/cortex-code.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/codex-acp.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/codebuddy-code.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/cline.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/claude-acp.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/autohand.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/auggie.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/amp-acp.svg Adds ACP registry agent icon asset.
packages/contracts/src/registry/icons/agoragentic-acp.svg Adds ACP registry agent icon asset.
packages/contracts/src/providerInstance.ts Adds authenticatedAt field to provider instance config.
packages/contracts/src/ipc.ts Adds Local API contract surface for ACP registry operations.
packages/contracts/src/index.ts Re-exports ACP registry contracts and bundled registry entrypoints.
packages/contracts/src/acpRegistry.ts Introduces ACP registry schemas, install state, and helper utilities.
package.json Adds sync:acp-registry script.
docs/providers/acp-registry.md Documents ACP registry bundling, install pipeline, and UI surfaces.
apps/web/vite.config.ts Adds Vite plugin to copy ACP icons into the web public directory at build/start.
apps/web/src/rpc/wsRpcClient.ts Adds ACP registry client methods to the WS RPC client.
apps/web/src/routes/settings.acp-registry.tsx Adds legacy route redirect to Providers settings.
apps/web/src/routeTree.gen.ts Registers the new ACP registry settings route in the generated router tree.
apps/web/src/modelSelection.test.ts Updates test fixtures to include enabled in provider instances.
apps/web/src/localApi.ts Exposes ACP registry methods via the browser Local API wrapper.
apps/web/src/components/settings/SettingsPanels.tsx Merges ACP registry into Providers panel and updates model picker UX.
apps/web/src/components/settings/ProviderInstanceCard.tsx Adds ACP auth UI for registry-backed provider instances.
apps/web/src/components/chat/ProviderStatusBanner.tsx Shows a friendly auth-required banner for unauthenticated ACP agents.
apps/web/src/components/chat/ProviderModelPicker.tsx Refactors model picker trigger to coordinate with new inline panel.
apps/web/src/components/chat/ProviderModelPicker.browser.tsx Updates browser tests to mount trigger + inline picker content together.
apps/web/src/components/chat/ProviderInstanceIcon.tsx Adds rendering of ACP registry icons for registry-backed drivers.
apps/web/src/components/chat/ModelPickerSidebar.tsx Switches provider picker to inline tile row and groups ACP entries.
apps/web/src/components/chat/ChatComposer.tsx Adds inline model picker panel above the composer when open.
apps/web/src/components/AcpRegistryIcon.tsx Adds a component to render ACP icons (mask-based) with fallback initials.
apps/server/src/ws.ts Wires ACP registry RPC handlers and provides the registry service layer.
apps/server/src/textGeneration/AcpRegistryTextGeneration.ts Adds unsupported text-generation shim for ACP registry agents.
apps/server/src/serverSettings.test.ts Updates tests to include enabled in provider instance configs.
apps/server/src/server.test.ts Mocks ACP registry service for server tests.
apps/server/src/provider/builtInDrivers.ts Registers one generic driver per bundled ACP registry entry.
apps/server/src/provider/acp/configOptionModels.ts Builds model lists from ACP session setup/config options.
apps/server/src/provider/acp/AcpSessionRuntime.ts Makes auth optional and captures auth methods + available modes.
apps/server/src/provider/acp/AcpMultiSession.ts Introduces multi-session ACP runtime with event parsing and config/mode setters.
apps/server/src/provider/acp/AcpAdapterSupport.ts Adds helper to resolve ACP permission outcomes to agent-advertised option ids.
apps/server/src/provider/acp/AcpAdapterSupport.test.ts Adds tests for permission outcome resolution.
apps/server/src/provider/Services/AcpRegistryAdapter.ts Adds adapter shape for ACP registry provider integration.
apps/server/src/provider/Layers/acpRegistryAdapter/types.ts Adds types for ACP registry adapter session and event context.
apps/server/src/provider/Layers/acpRegistryAdapter/permissionHandlers.ts Implements permission request handling + decision bridging.
apps/server/src/provider/Layers/acpRegistryAdapter/helpers.ts Adds helper to reconcile previously-selected ACP model against agent options.
apps/server/src/provider/Layers/acpRegistryAdapter/fileHandlers.ts Adds secure file read/write handlers for ACP sessions (cwd sandboxing).
apps/server/src/provider/Layers/acpRegistryAdapter/fileHandlers.test.ts Adds tests for ACP path sandboxing.
apps/server/src/provider/Layers/acpRegistryAdapter/eventForwarding.ts Forwards ACP session events into provider runtime events.
apps/server/src/provider/Layers/ProviderInstanceRegistryHydration.ts Ensures hydrated legacy provider instances default to enabled.
apps/server/src/provider/Drivers/AcpRegistryDriver.ts Implements data-driven provider driver for each ACP registry agent.
apps/server/src/provider/Drivers/AcpRegistryDriver.test.ts Adds tests for ACP model option parsing.
apps/server/src/config.ts Adds derived cache dir for ACP registry installs and ensures it exists.
apps/server/src/acpRegistry/platform.ts Maps Node platform/arch to ACP registry binary platform literals.
apps/server/src/acpRegistry/orphanReaper.ts Adds boot-time orphan process reaping for detached ACP agents.
apps/server/src/acpRegistry/installer.ts Implements install/uninstall and safe extraction/spawn-target resolution.
apps/server/src/acpRegistry/installer.test.ts Adds installer tests for binary installs, checksums, and path safety.
apps/server/src/acpRegistry/installManifest.ts Adds manifest persistence + migration from settings with atomic writes.
apps/server/src/acpRegistry/installManifest.test.ts Adds tests for manifest read/write, migration, and corruption handling.
apps/server/src/acpRegistry/childProcessRegistry.ts Adds process-wide child PID tracking for hard shutdown cleanup.
apps/server/src/acpRegistry/AcpRegistryService.test.ts Adds tests for auth probe timeouts by distribution.
AGENTS.md Documents ACP registry support and points to the new provider docs.
Comments suppressed due to low confidence (4)

apps/web/vite.config.ts:1

  • __dirname is not defined in ESM (which Vite config commonly runs as). This will throw at runtime and prevent the dev server/build from starting. Use fileURLToPath(import.meta.url) + path.dirname(...) (or Vite's new URL(..., import.meta.url)) instead of __dirname to resolve paths.
    apps/web/src/components/AcpRegistryIcon.tsx:1
  • This element sets both aria-label and aria-hidden, which is contradictory (screen readers will ignore the label). Decide whether the icon is decorative (keep aria-hidden and remove role/aria-label) or meaningful (remove aria-hidden and keep an appropriate label).
    scripts/sync-acp-registry.ts:1
  • The script currently excludes no agents, but the docs and surrounding changes indicate overlapping first-party drivers (e.g. claude-acp, cursor, opencode, codex-acp) should be filtered out of the bundled snapshot. Populate EXCLUDED_AGENT_IDS with the intended ids (or load them from config) so the generated registry.json matches the documented behavior.
    docs/providers/acp-registry.md:1
  • This description doesn't match the implementation in the PR: the sync script only writes into the contracts icons/ directory, while the web public/acp-icons population is handled by a Vite plugin at build/start time. Update this doc to reflect the actual pipeline (and/or update the script to copy into apps/web/public/acp-icons/ as described) to avoid stale operational instructions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/server/src/server.test.ts Outdated
Comment on lines +553 to +560
install: (agentId) =>
Effect.fail(
new AcpRegistryError({
agentId,
detail: "ACP registry install is disabled in tests.",
}),
),
uninstall: () => Effect.void,
Comment on lines +100 to +110
// Cleanup: clear stale settings.json entries after successful migration
yield* settingsService
.updateSettings({ acpRegistryInstalls: {} })
.pipe(
Effect.asVoid,
Effect.mapError(
(cause) =>
new InstallManifestError({ detail: "Failed to cleanup stale settings after migration", cause }),
),
);
yield* Effect.logInfo("Migrated ACP registry installs from settings.json to manifest and cleaned up stale entries");
Comment on lines +152 to +174
it("uses PowerShell Expand-Archive on Windows for zip extraction", async () => {
// This test verifies the Windows extraction path is correctly configured
// Actual extraction is platform-specific, so we only test the path resolution
const cacheRoot = await fs.mkdtemp(path.join(os.tmpdir(), "t3-acp-install-"));
const entry = rawEntry("", "./agent.exe");

// Mock Windows platform
const originalPlatform = process.platform;
Object.defineProperty(process, "platform", { value: "win32" });

try {
// The installer should handle Windows-specific extraction
// We can't actually test PowerShell execution in cross-platform tests,
// but we can verify the code path exists and is reachable
expect(
(entry.distribution.binary as Record<string, unknown> | undefined)?.["win32-x86_64"],
).toBeUndefined();
// This is a minimal test to ensure the Windows path is covered
// Full extraction testing would require Windows-specific CI
} finally {
Object.defineProperty(process, "platform", { value: originalPlatform });
await fs.rm(cacheRoot, { recursive: true, force: true });
}
};
connections.set(key, pooled);
return pooled;
});

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.

Connection pool race condition leaks child processes

Medium Severity

The connections Map is a plain mutable Map accessed by concurrent fibers without synchronization. In acquireConnection, between connections.get(key) returning undefined (line 201) and connections.set(key, pooled) (line 233), there are multiple yield* async boundaries where other fibers can run. Two concurrent callers (e.g., discoverModels fork and a startSession call) targeting the same key can both see no existing entry, both spawn a child process, and the second set overwrites the first — permanently leaking the first connection's child process.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cd5e45c. Configure here.

Comment thread apps/server/src/provider/Layers/AcpRegistryAdapterLayer.ts Outdated
@macroscopeapp

macroscopeapp Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

@iliyasone

Copy link
Copy Markdown

So how to use it? I clone and build, but the "ACP Registry" still have a Coming Soon bage

@LivioGama

LivioGama commented Jun 12, 2026

Copy link
Copy Markdown
Author

So how to use it? I clone and build, but the "ACP Registry" still have a Coming Soon bage

@iliyasone Are you sure you are on the right branch? I don't have any ACP Registry entry

CleanShot 2026-06-12 at 18 10 47@2x

My version present this way:
CleanShot 2026-06-12 at 18 12 23

Co-authored-by: codex <codex@users.noreply.github.com>

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

Cursor Bugbot has reviewed your changes using high effort and found 7 potential issues.

There are 8 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

auth: {
status: "unknown",
...(hasAuthMethods ? { authMethods: installState?.authMethods ?? [] } : {}),
},

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.

Auth success never updates UI

High Severity

The AcpRegistryDriver always sets the provider's auth.status to unknown in snapshots, ignoring the authenticatedAt timestamp. This causes the UI to continuously display authentication controls, even after a successful authentication flow.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

detail: "Uninstall failed",
cause,
}),
});

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.

Uninstall drops instances too early

Medium Severity

uninstall removes matching entries from providerInstances in settings before Installer.uninstallAgent runs. If cache removal fails, the effect errors out while instances are already gone, but the install manifest still lists the agent as installed—leaving registry “installed” state without a usable provider instance.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

authenticatedAt: now,
},
},
})

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.

Authenticate tears down instance

Medium Severity

Persisting authenticatedAt after authenticate changes the stored ProviderInstanceConfig, so registry reconcile treats the instance as replaced, closes its scope, and rebuilds the driver. A settings-only auth action can drop active ACP sessions and pooled connections unexpectedly.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

detail: `Cannot uninstall ${entry.name}: ${activeSessions.length} active session(s) using this provider. Close them first.`,
});
}
}

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.

Uninstall skips session guard

Medium Severity

ACP registry uninstall only blocks when active sessions exist if ProviderSessionRuntimeRepository is present in the effect context. When that service is optional and absent, uninstall proceeds without checking persisted or in-flight sessions, then removes provider instances and install state while adapters may still hold live ACP sessions.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

type: "image",
data: Buffer.from(bytes).toString("base64"),
mimeType: attachment.mimeType,
});

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.

All attachments sent as images

Medium Severity

In sendTurn, every attachment is encoded as an ACP image content block with base64 data, regardless of attachment.mimeType. Non-image files (PDF, text, etc.) are mislabeled, which can break agents or corrupt prompt handling.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

provider,
operation: "sendTurn",
issue: "Turn requires non-empty text or attachments.",
});

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.

Turn started without completion

Medium Severity

In the ACP registry adapter, sendTurn emits turn.started and sets activeTurnId before validating attachments or non-empty prompt input. Validation failures return early without a matching turn.completed (or equivalent) event, leaving orchestration and checkpoint logic with an orphaned started turn and a session still marked as having an active turn.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

const cmd = match[2];
if (pid === myPid) continue;
if (!cmd || !cmd.startsWith(binaryPath)) continue;
victims.push(pid);

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.

Orphan reaper prefix matching

High Severity

Boot-time orphan cleanup selects processes whose command line startsWith the managed binary path. A longer executable path that shares that prefix (for example a sibling binary whose path extends the cached agent path) can be matched and receive SIGKILL even though it is not the managed agent binary.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a9eeeef. Configure here.

Comment on lines +220 to +221
const relative = NodePath.relative(root, targetPath);
if (relative === "" || (!relative.startsWith("..") && !NodePath.isAbsolute(relative))) {

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.

🟢 Low acpRegistry/installer.ts:220

assertInsideRoot rejects valid paths whose names begin with .. but are not parent-directory traversals. For example, a file named ..foo inside the root produces relative === "..foo", and "..foo".startsWith("..") is true, so the function throws even though the path is inside the root. The check needs to distinguish .. and ../ (actual traversal) from names that merely start with those characters.

   const relative = NodePath.relative(root, targetPath);
-  if (relative === "" || (!relative.startsWith("..") && !NodePath.isAbsolute(relative))) {
+  if (relative === "" || (relative !== ".." && !relative.startsWith(".." + NodePath.sep) && !NodePath.isAbsolute(relative))) {
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/acpRegistry/installer.ts around lines 220-221:

`assertInsideRoot` rejects valid paths whose names begin with `..` but are not parent-directory traversals. For example, a file named `..foo` inside the root produces `relative === "..foo"`, and `"..foo".startsWith("..")` is `true`, so the function throws even though the path is inside the root. The check needs to distinguish `..` and `../` (actual traversal) from names that merely start with those characters.

Evidence trail:
apps/server/src/acpRegistry/installer.ts lines 219-225 (assertInsideRoot function definition with `relative.startsWith("..")` check), lines 236-241 (caller: resolveCmdPath), lines 350-355 (caller: archive validation). Node.js path.relative documentation at https://nodejs.org/api/path.html confirms path.relative returns the filename component directly, so `..foo` as a filename returns `'..foo'` which `.startsWith('..')` matches.


merged[instanceId] = {
driver: driver.driverKind,
enabled: true,

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.

🟡 Medium Layers/ProviderInstanceRegistryHydration.ts:99

Synthesized legacy provider envelopes hardcode enabled: true, so providers explicitly disabled via settings.providers.<kind>.enabled = false are re-enabled anyway. The driver's create method merges config.enabled with the envelope's enabled field, so the hardcoded true overwrites the user's setting. Consider reading enabled from the legacy config instead.

Suggested change
enabled: true,
enabled: (legacyConfig as { enabled?: boolean }).enabled ?? true,
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/provider/Layers/ProviderInstanceRegistryHydration.ts around line 99:

Synthesized legacy provider envelopes hardcode `enabled: true`, so providers explicitly disabled via `settings.providers.<kind>.enabled = false` are re-enabled anyway. The driver's `create` method merges `config.enabled` with the envelope's `enabled` field, so the hardcoded `true` overwrites the user's setting. Consider reading `enabled` from the legacy config instead.

Evidence trail:
apps/server/src/provider/Layers/ProviderInstanceRegistryHydration.ts lines 97-101 (hardcoded `enabled: true` in synthesized envelope), apps/server/src/provider/Layers/ProviderInstanceRegistryLive.ts line 174 (`enabled: entry.enabled ?? decodedConfigEnabled(typedConfig) ?? true`), apps/server/src/provider/Layers/ProviderInstanceRegistryLive.ts lines 96-102 (`decodedConfigEnabled` helper), packages/contracts/src/settings.ts lines 252-253 (CursorSettings defaults `enabled` to `false`), packages/contracts/src/providerInstance.ts line 129 (`enabled: Schema.optionalKey(Schema.Boolean)` — envelope `enabled` is optional)

@juliusmarminge

Copy link
Copy Markdown
Member

#2829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants