feat(acp): bring your own harness (BYOH) — generic ACP runtime seam + settings gallery#2773
Draft
wpfleger96 wants to merge 3 commits into
Draft
feat(acp): bring your own harness (BYOH) — generic ACP runtime seam + settings gallery#2773wpfleger96 wants to merge 3 commits into
wpfleger96 wants to merge 3 commits into
Conversation
wpfleger96
marked this pull request as draft
July 24, 2026 23:16
wpfleger96
force-pushed
the
duncan/byoh-generic-acp-harness
branch
2 times, most recently
from
July 25, 2026 02:55
bda1871 to
fa4034b
Compare
7 tasks
wpfleger96
force-pushed
the
duncan/byoh-generic-acp-harness
branch
from
July 25, 2026 05:16
fa4034b to
5ebabda
Compare
Implement a generic BYOH mechanism that lets any ACP-speaking harness (Cursor, Pi, Amp, OpenClaw, Hermes, etc.) work with Buzz without maintaining separate backend code per harness type. Backend (Rust): - Add HarnessDefinition, HarnessSource, PRESET_HARNESSES (8 presets: cursor/omp/grok/opencode/kimi/amp/hermes/openclaw) + custom harness loading from ~/.config/buzz/custom-harnesses/ - warm_harness_registry_from_dir called at startup (before restore) and transactionally on save/delete; try_record_agent_command returns typed DANGLING_HARNESS_ID:<id> error — never silently falls to default - Full descriptor resolved at spawn/readiness/spawn_hash paths; definition env merges below Buzz-reserved vars; edit round-trip carries definition_env in catalog entry - All sweep paths (reap_dead_instance_agents, kill_stale_tracked_processes, receipt cleanup) use marker/receipt ownership — no name-gating - save_custom_harness validates before mutation; atomic write + old-file delete on rename; preset ids reserved in check_id_collision - buzz_sweep_owns_process cross-platform (no #[cfg(unix)] guard) Frontend (TypeScript): - Settings > Agents BYOH gallery: preset cards (Detected/Not-installed + docs link, no Add button), custom cards (full edit/delete) - ArgsEditor (repeatable rows) + EnvEditor (KEY=VALUE pairs) - HarnessManagementCard + harnessFormLogic.ts (21 behavior tests) - harnessGalleryLogic.ts (11 tests: detected-first sort, preset filtering) - Onboarding: actionable 'More harnesses...' button → Settings > Agents - PRESET_LOGOS bundled map; avatarUrl stripped from all surfaces Tests: +27 frontend / +20 Rust lib (registry lifecycle, env round-trip, sweep ownership, legacy-JSON serde, preset collision) Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96
force-pushed
the
duncan/byoh-generic-acp-harness
branch
from
July 25, 2026 05:20
5ebabda to
277d8b0
Compare
…safe registry
B-4 (persistence contract): Replace the two simulated round-trip tests that
called raw fs::write/remove_file with six tests that exercise the real
save_custom_harness_to_dir helper directly:
- save_to_dir_create_writes_file_and_loads_back
- save_to_dir_same_id_edit_replaces_content
- save_to_dir_backup_is_cleaned_up_after_same_id_edit
- save_to_dir_rename_removes_old_file_and_creates_new
- save_to_dir_rename_nonexistent_old_id_is_non_fatal
- save_to_dir_roundtrip_with_env_preserves_values
B-3 (env validation boundary): Six tests exercising validate_harness_definition_pub
integration with validate_user_env_keys for the documented attack surfaces:
- validate_rejects_malformed_key_with_equals_sign (BUZZ_AUTH_TAG=x forgery shape)
- validate_rejects_reserved_key_buzz_managed_agent (ownership marker)
- validate_rejects_reserved_key_case_insensitive (lowercase bypass)
- validate_rejects_nul_byte_in_value (Command::env panic protection)
- validate_rejects_value_over_per_value_size_limit
- validate_accepts_well_formed_env
B-2 (API boundary): Export fromRawAcpRuntimeCatalogEntry from tauri.ts and
add four tests to tauri.test.mjs proving the Rust definition_env snake_case
field is mapped to definitionEnv camelCase, that absent definition_env defaults
to {} (not undefined), and that env round-trips end-to-end through the mapper
so a save-then-edit cycle cannot erase definition env.
B-6 (concurrent-safe registry): Add save_and_warm + delete_and_warm functions
in custom_harnesses.rs that hold a PERSIST_MUTEX for the filesystem mutation
and the subsequent warm_harness_registry_from_dir call as an atomic unit.
Update save_custom_harness and delete_custom_harness Tauri commands to use
these helpers. Eliminates the lost-update window where two concurrent saves
could interleave their warm calls and produce a stale registry snapshot.
File-size override added for custom_harnesses.rs (1042 lines after the new
tests; queued to split once the feature stabilizes).
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
D-12: Revert mobile/pubspec.lock to origin/main. The meta 1.17→1.18 /
test 1.30→1.31 churn was a no-source-change lockfile bump introduced by
accident; reverting eliminates the unrelated diff.
D-15: Add OpenClaw execution-locus note to the preset's install_hint.
Eva's finding: openclaw acp executes tools inside the Gateway daemon, not
in the Desktop process. Desktop-injected BUZZ_* env vars reach the
openclaw harness process itself but do NOT automatically propagate to
the Gateway's execution environment. The install_hint now surfaces this
caveat so users who need BUZZ_* credentials at execution time know they
must set them on the Gateway's own environment.
F8 (onboarding navigate test): New pure-logic test file
postOnboardingNav.test.mjs proves the App.tsx postOnboardingNav
useEffect predicate — navigateAfterComplete does not fire before
machine.stage reaches 'ready', fires exactly once on the ready
transition, is cleared after firing (no double-fire), fires immediately
if nav arrives while already ready, and carries the exact
{to: '/settings', search: {section: 'agents'}} shape from
MachineOnboardingFlow's navigateToAgentSettings action.
C-10 (e2eBridge + handler tests): Extract save_custom_harness /
delete_custom_harness handler logic into e2eBridgeCustomHarnesses.ts
(exported module-level functions + mockCustomHarnesses Map +
resetMockCustomHarnesses). Wire the handlers into e2eBridge.ts:
- mockCustomHarnesses imported and appended to discover_acp_providers
results so saved custom harnesses appear in future discovery calls
- case 'save_custom_harness' → handleSaveCustomHarness
- case 'delete_custom_harness' → handleDeleteCustomHarness
New test file e2eBridgeCustomHarnesses.test.mjs (14 tests across 3
describe groups) proves: save → store, non-empty env preserved,
empty env absent, same-ID edit replaces, rename removes old + inserts
new, delete removes, delete idempotent, Map reference is shared.
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements a "bring your own harness" (BYOH) generic ACP mechanism — replacing per-harness backend code with a data-driven 3-tier system:
PRESET_HARNESSES, no code duplication, icons stay TerminalSquare/bundled-asset-onlycustom_harnesses/under app data; managed via Settings → Agents UIChanges
Core data model
HarnessDefinition— id, label, command, args, env, install URL/hintPRESET_HARNESSESstatic table — single source of truth for all presets;preset_harness_ids()derives reserved IDs (D-11: no hand-maintained copy)source: "builtin" | "preset" | "custom"tagging on every catalog entryPersistence (B-4, B-6)
save_custom_harness_to_dir(dir, definition, rename_old_id)— backup-swap atomic write (backs up target → .bak, commits temp → target, restores .bak on failure, removes .bak on success); safe on Windows wherefs::renameover an existing file is "access denied"save_and_warm/delete_and_warm— holdPERSIST_MUTEXfor the write + registry-warm pair, eliminating the lost-update race (B-6) where two concurrent saves could interleave their warm calls and leave a stale registry snapshotEnv validation boundary (B-3)
validate_harness_definition_pubcallsvalidate_user_env_keyson definition env at save AND loadTypeScript boundary (B-2 / Thufir CRITICAL)
RawAcpRuntimeCatalogEntrynow declaresdefinition_env?: Record<string,string>andsource: "builtin" | "preset" | "custom"fromRawAcpRuntimeCatalogEntrymapsdefinition_env → definitionEnv(camelCase); absent field defaults to{}entry.definitionEnv— env no longer erased on save-then-edit cycleUnified descriptor (Phase A / Thufir F4)
EffectiveHarnessDescriptor { command, args, env }inreadiness.rsresolve_effective_harness_descriptor()— single resolver used by spawn, spawn_hash, summary, get_agent_models (both saved and unsaved), and readinessOther fixes
runtime.defaultArgsintorecord.agent_argson normal create pathsMissingBinaryvariant for custom commands not found on PATHsetTimeout(0)removed, parent-owned route intent vianavigateAfterCompletepropHarnessManagementCardusesharnessGalleryLogichelpers (killed duplicate filter/sort)BUILTIN_IDSderived fromPRESET_HARNESSES(no hand-maintained copy)mobile/pubspec.lockchurn revertedinstallInstructionsUrlTests added
B-4 persistence (6 tests):
save_to_dir_create_writes_file_and_loads_back,save_to_dir_same_id_edit_replaces_content,save_to_dir_backup_is_cleaned_up_after_same_id_edit,save_to_dir_rename_removes_old_file_and_creates_new,save_to_dir_rename_nonexistent_old_id_is_non_fatal,save_to_dir_roundtrip_with_env_preserves_valuesB-3 env validation (6 tests):
validate_rejects_malformed_key_with_equals_sign,validate_rejects_reserved_key_buzz_managed_agent,validate_rejects_reserved_key_case_insensitive,validate_rejects_nul_byte_in_value,validate_rejects_value_over_per_value_size_limit,validate_accepts_well_formed_envB-2 API boundary (4 TS tests in tauri.test.mjs):
fromRawAcpRuntimeCatalogEntry maps definition_env to definitionEnv,defaults definitionEnv to {} when absent,preserves source preset,env round-trips through edit payload shapePreset catalog
cursorcursorampamphermeshermes-agentopenclawopenclawpipi-agentcodestoryaideGate table — head
f7c55505ecargo test --libjust desktop-testjust desktop-typecheckjust desktop-checkjust desktop-tauri-clippyjust desktop-buildPR head:
f7c55505e66f8f8634d997f54c022f3fbe68e417— MERGEABLE