Skip to content

refactor(acp): migrate connection layer to sacp v10#380

Merged
CSRessel merged 2 commits intodevfrom
feat/sacp-v10-migration
Mar 8, 2026
Merged

refactor(acp): migrate connection layer to sacp v10#380
CSRessel merged 2 commits intodevfrom
feat/sacp-v10-migration

Conversation

@CSRessel
Copy link
Copy Markdown
Collaborator

@CSRessel CSRessel commented Mar 7, 2026

Summary

🤖 Generated with Nori

  • Replaces agent-client-protocol v0.9 connection layer (AcpConnection + dedicated worker thread) with sacp v10 SacpConnection that runs directly on the main tokio runtime, eliminating ~266 lines of complexity
  • Adds WriteTextFileRequest and ReadTextFileRequest handlers as chained .on_receive_request() calls with the same workspace security boundaries as the old ClientDelegate
  • Preserves process group isolation, parent death signal, environment stripping, and all existing behavioral contracts — 373 unit tests + 69/70 E2E tests pass (1 pre-existing failure in test_startup_error_for_unregistered_model)

Architecture Changes

  • No more worker thread: SACP v10's ClientToAgent is Send + Sync, so all operations run on the main tokio runtime
  • Builder-based handler registration: Uses ClientToAgent::builder().on_receive_request() chains instead of a Client trait implementation
  • Dynamic update routing: Arc<Mutex<Option<Sender<SessionUpdate>>>> swaps between prompt-active and persistent channels
  • Non-blocking drop: SacpConnection::drop() aborts tasks and kills the process group without spawn_blocking

Files

  • New: sacp_connection.rs (connection impl), sacp_connection_tests.rs (7 integration tests)
  • Deleted: client_delegate.rs, public_api.rs, worker.rs, tests.rs (old connection layer)
  • Modified: backend/*.rs (AcpConnection→SacpConnection), translator.rs, lib.rs, Cargo.toml, docs.md

Test Plan

  • 373 codex-acp unit tests pass
  • 7 new SACP connection integration tests pass
  • 69/70 E2E tests pass (1 pre-existing failure: test_startup_error_for_unregistered_model)
  • Clippy clean, formatted
  • Manual smoke test with a real ACP agent (claude-code or gemini)

Share Nori with your team: https://www.npmjs.com/package/nori-skillsets

CSRessel and others added 2 commits March 7, 2026 12:27
….9 to sacp v10

Replace the old AcpConnection (which required a dedicated worker thread
due to !Send futures) with SacpConnection using sacp v10's Send + Sync
ClientToAgent. This eliminates the worker thread, command channel,
ClientDelegate trait impl, and spawn_blocking for drop.

Key changes:
- New SacpConnection using ClientToAgent::builder() with chained
  on_receive_request handlers for permissions, file writes, file reads
- Dynamic session update routing via Arc<Mutex<Option<Sender>>>
- Approval flow uses cx.spawn() to avoid blocking dispatch
- Process group isolation and cleanup preserved
- 7 integration tests for the new connection layer
- All E2E tests pass (69/70 with 1 pre-existing failure)
- Net reduction of ~266 lines of code
🤖 Generated with [Nori](https://usenori.ai)

Co-Authored-By: Nori <contact@tilework.tech>
@CSRessel CSRessel merged commit 0e857c5 into dev Mar 8, 2026
3 checks passed
@CSRessel CSRessel deleted the feat/sacp-v10-migration branch March 8, 2026 05:46
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