Skip to content

feat: ACP agent registry with binary detection and health checking - #1021

Merged
malibio merged 1 commit into
mainfrom
feature/issue-1002-acp-registry
Apr 3, 2026
Merged

malibio merged 1 commit into
mainfrom
feature/issue-1002-acp-registry

Conversation

@malibio

@malibio malibio commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implements SystemAgentRegistry for discovering available ACP agents
  • Binary detection via PATH, version health checks, auth validation
  • Cached results with 5-minute TTL refresh

Closes #1002

Co-Authored-By: Claude [email protected]

…loses #1002)

Implements SystemAgentRegistry for discovering available external ACP
agents on the user's system. Includes binary PATH detection, version
health checks, auth validation, and cached results with TTL refresh.

Co-Authored-By: Claude <[email protected]>
@malibio
malibio force-pushed the feature/issue-1002-acp-registry branch from 944d082 to b2030b2 Compare April 3, 2026 22:56
@malibio
malibio merged commit e5b534f into main Apr 3, 2026
@malibio
malibio deleted the feature/issue-1002-acp-registry branch April 3, 2026 22:56
@malibio

malibio commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator Author

Post-Merge Code Review: PR #1021 (ACP agent registry)

Verdict: Has issues that need follow-up.

Findings

[Improvement] Thread safety concern with std::env::set_var / std::env::remove_var in tests

File: packages/desktop-app/src-tauri/src/acp/registry.rs (tests around lines 400-435, 547)

std::env::set_var() and std::env::remove_var() are unsound in multi-threaded programs as of Rust 1.66+ (deprecated, and unsafe since Rust 1.80). These are called in #[test] (not #[tokio::test]) functions, but Cargo runs tests in parallel threads within the same process. If two tests manipulate the same env var concurrently, behavior is undefined.

Fix: Either use #[serial_test::serial] to serialize these tests, or refactor auth_satisfied() to accept an environment lookup function that can be mocked in tests without touching the real process environment.

[Improvement] Code duplication between full_probe() and background refresh task

The background refresh task (spawned in ensure_background_refresh) duplicates the entire probe-and-build-agent-info loop from full_probe(). This is ~30 lines of identical logic.

Fix: Extract the probing logic so the background task calls self.full_probe() or a free function, rather than inlining the same code.

Notes

  • The hardcoded agent catalog is appropriate for v1. The which crate correctly resolves binaries on PATH.
  • Good cache TTL pattern with Instant-based freshness check.
  • --version health probe with timeout is a sensible liveness check.
  • Auth validation correctly rejects empty/whitespace-only API keys.
  • 15 tests provide solid coverage.

Follow-up needed: env var test safety, code dedup in background task.

malibio added a commit that referenced this pull request Jun 22, 2026
…loses #1002) (#1021)

Implements SystemAgentRegistry for discovering available external ACP
agents on the user's system. Includes binary PATH detection, version
health checks, auth validation, and cached results with TTL refresh.

Co-authored-by: Michael Libio <[email protected]>
Co-authored-by: Claude <[email protected]>
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.

ACP agent registry with binary detection and health checking

1 participant