buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Release builds prefer sidecars from the build workspace and the current directory over their bundled ones

Open kleinbem opened this issue 1 month ago • 1 comments

Describe the bug managed_agents/discovery.rs builds the sidecar search path in command_search_dirs() from, in this order: workspace_root_dir() (env!("CARGO_MANIFEST_DIR")/../.., the checkout the app was compiled in), target/{debug,release} under the current directory, and only then the directory of the running executable, where the bundled sidecars are. This applies in every build profile, so a release binary embeds its build path and searches it first.

For an installed app that means:

  • if the build checkout still exists on the machine (local release builds), its target/ binaries are used instead of the bundled ones, even when they are older;
  • starting Buzz from a directory that contains a target/release/buzz-acp (any Buzz checkout) silently swaps in those sidecars.

Steps to reproduce

  1. Build and install a release app (just desktop-release-build), keep the checkout.
  2. Rebuild one sidecar in the checkout, e.g. cargo build --release -p buzz-acp after a change.
  3. Start the installed app and run an agent. resolve_command → resolve_workspace_command walks command_search_dirs() in the order above, so it picks the checkout's buzz-acp, not the bundled one. (I traced this in the code; the nixpkgs build patches it out, so I haven't watched it happen in a running app.)

Expected behavior Release builds use the bundled sidecars next to the executable. Searching the workspace and the current directory is useful for just dev, so it could stay behind cfg(debug_assertions).

Version and platform

  • Buzz version: 0.5.28 (code as of main 347ce88d5)
  • OS: NixOS (x86_64-linux); the code path is platform-independent

Logs / additional context #3069 (by @fitz2882) and #2655 both put the bundled sidecars first in release builds, which fixes the main symptom; I missed #3069 when searching before filing this. Both keep the build-checkout and current-directory entries as fallbacks. nixpkgs carries a small patch by @sebfried that gates workspace_root_dir() behind debug_assertions; I'd be glad to open it as a PR if that's the preferred fix.

kleinbem avatar Oct 22 '26 15:10 kleinbem

Closing: I'm focusing on Buzz 1.0 (block/buzz-app), which doesn't use this code.

kleinbem avatar Oct 23 '26 12:10 kleinbem