buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Desktop dev builds: empty sidecar stubs shadow real binaries, so agent sign-in fails as "Sign-in unavailable"

Open drabdhafizr opened this issue 4 months ago • 2 comments

Describe the bug

On a source build, agent sign-in is impossible: the onboarding runtime card shows "Sign-in unavailable". The label points at the auth provider, but the cause is local — the desktop cannot execute its own buzz-acp helper.

just dev depends on _ensure-sidecar-stubs (Justfile:153), which touches five empty placeholder files so the Tauri build doesn't fail on missing sidecars:

buzz-acp  buzz-agent  buzz-dev-mcp  git-credential-nostr  buzz

The helper is then resolved in desktop/src-tauri/src/commands/agent_auth.rs:122:

let acp_path = std::env::current_exe()
    .map(|path| path.with_file_name(format!("buzz-acp{}", std::env::consts::EXE_SUFFIX)))
    .ok()
    .filter(|path| path.exists())      // existence only — not executability
    .or_else(|| resolve_command("buzz-acp"))
    .ok_or_else(|| "buzz-acp helper not found".to_string())?;

The 0-byte stub lands next to buzz-desktop in desktop/src-tauri/target/debug/, so it satisfies path.exists() and the or_else fallback that would have found the real binary never runs. The real binaries build into the workspace target (target/debug/), a different directory, so the two never meet.

Executing the stub returns permission denied (mode -rw-r--r--, 0 bytes), discover_acp_auth_methods returns Err, and SetupStep.tsx:189 renders label="Sign-in unavailable" — which is the "couldn't load sign-in options" branch, distinct from the "Sign-in failed" branch for an actual auth failure. The message therefore misattributes a local exec failure to the provider.

All five stubs are affected, so the same shadowing should also break the agent runtime, dev MCP tools, git credential signing, and the bundled CLI.

Steps to reproduce

  1. Clone, then . ./bin/activate-hermit && just setup && just dev
  2. In onboarding, find a runtime whose availability is available and auth status logged_out (reproduced with claude-agent-acp)
  3. Click SIGN IN
  4. The card shows "Sign-in unavailable"

Reproduce without the UI:

# what the app runs — 0-byte stub
./desktop/src-tauri/target/debug/buzz-acp auth-methods --json
# -> permission denied

# the real binary, same args
BUZZ_ACP_AGENT_COMMAND=$(command -v claude-agent-acp) \
  ./target/debug/buzz-acp auth-methods --json
# -> {"methods":[{"id":"claude-ai-login",...},{"id":"console-login",...}]}

Expected behavior

The desktop should locate a working buzz-acp. Either:

  • gate the adjacent-path candidate on executability and non-emptiness rather than path.exists(), so the resolve_command fallback engages; and/or
  • have _ensure-sidecar-stubs write a non-executable name that cannot be mistaken for a real sidecar, or skip stubbing when a real build exists.

Separately, "Sign-in unavailable" is worth rewording. A failure to spawn a local helper reads as a provider outage, which sent this debugging session to the wrong place first.

Version and platform

  • Buzz version: source build at 485d03a35 (workspace 0.1.0, desktop 0.5.0)
  • OS: macOS 15 (Darwin 25.5.0), Apple Silicon (aarch64-apple-darwin)
  • Adapter: @agentclientprotocol/claude-agent-acp 0.63.0

Logs / additional context

Stub as built by just dev:

-rw-r--r--  0  desktop/src-tauri/target/debug/buzz-acp
-rwxr-xr-x  40259608  target/debug/buzz-acp

Workaround — fill both the stub source and the resolved path:

TARGET=aarch64-apple-darwin
for b in buzz-acp buzz-agent buzz-dev-mcp git-credential-nostr buzz; do
  cp -f "target/debug/$b" "desktop/src-tauri/binaries/${b}-${TARGET}"
  cp -f "target/debug/$b" "desktop/src-tauri/target/debug/$b"
  chmod +x "desktop/src-tauri/binaries/${b}-${TARGET}" "desktop/src-tauri/target/debug/$b"
done

binaries/ is gitignored and _ensure-sidecar-stubs uses touch (which does not truncate), so filled binaries survive later just dev runs. The workaround does carry a staleness footgun: after a later git pull + rebuild, target/debug/ updates while the two copies do not, and the adjacent copy still wins — so the app would silently run stale sidecars. That is an argument for fixing the resolution order rather than the stubs.

drabdhafizr avatar Aug 04 '26 17:08 drabdhafizr

Reproduced on macOS arm64 in this checkout (main, 2026-08-05), with command-level proof.

What I ran

cd /Users/vaibhavjain/projects/buzz/buzz
. ./bin/activate-hermit
just _ensure-sidecar-stubs
cargo build -p buzz-acp

# force the adjacent tauri-debug helper path to be the empty stub shape
mkdir -p desktop/src-tauri/target/debug
: > desktop/src-tauri/target/debug/buzz-acp
chmod 0644 desktop/src-tauri/target/debug/buzz-acp

# compare execution of adjacent stub vs workspace-built helper
./desktop/src-tauri/target/debug/buzz-acp --help
./target/debug/buzz-acp --help

Observed output

stub_help_exit=126
real_help_exit=0

--- stub help stderr ---
permission denied: ./desktop/src-tauri/target/debug/buzz-acp

--- real help first lines ---
ACP harness that bridges Buzz events to AI agents
Usage: buzz-acp [OPTIONS] --private-key <PRIVATE_KEY>
...

File state at repro time

-rw-r--r--  0        desktop/src-tauri/target/debug/buzz-acp
-rwxr-xr-x  37261176 target/debug/buzz-acp

This confirms the shadowing behavior described in the issue: a non-executable adjacent buzz-acp path exists, while a valid buzz-acp binary is present in workspace target output.

I also confirmed the corresponding UI error mapping remains wired to this path (Sign-in unavailable from auth-method discovery failure branch in onboarding runtime cards).

VaibhavJain2609 avatar Aug 05 '26 08:08 VaibhavJain2609

Still reproduces on current main (e982f70fb), macOS arm64. git diff --stat 9cc9652..e982f70fb -- desktop/src-tauri/src/commands/agent_auth.rs is empty, so the diagnosis above still holds exactly as written.

Two things that may explain why it has lasted:

  • CI cannot catch it. .github/workflows/_ci-desktop-macos.yml:46-51 stages sidecars with the same touch of 0-byte files (_ci-rust.yml:135-142 likewise for Windows), so every desktop job builds against the broken shape.
  • dev is the only lane of four that skips the real copy. desktop-standalone (Justfile:765), staging (810) and production (845) all cp the built binaries over the stubs; dev (695) stops at _ensure-sidecar-stubs.

Opened #8077 for the dev lane, mirroring desktop-standalone's existing block, plus a contract test that fails on main and compares the staged set against the stubbed set so a newly stubbed sidecar cannot ship unexecutable.

That PR deliberately leaves this issue's other two points alone, since they are separate layers: gating on executability instead of path.exists() (the resolve_command fallback is dead code while a placeholder is present), and rewording "Sign-in unavailable", which still reads as a provider outage. Happy to follow up on either.

Workaround meanwhile: just desktop-standalone once stages all six sidecars, after which just dev works, because _ensure-sidecar-stubs uses touch and will not truncate a real binary.

🤖 Generated with Claude Code

bitcoin3us avatar Oct 04 '26 08:10 bitcoin3us