buzz icon indicating copy to clipboard operation
buzz copied to clipboard

fix(desktop,acp): shared-compute usability — toggle, usage indicator, model resync, reply delivery

Open micspiral opened this issue 4 months ago • 3 comments

image

One CRITICAL thing this adds is a fallback for buzz agent so if a modest model returns in prose, it can capture it as an answer instead of just silently dropping it.

Shared-compute usability fixes, discovered while getting a local agent to reliably run and reply on Buzz shared compute. Four related but distinct changes:

1. Share toggle reflects serve mode, not slot occupancy

  • Serve (sharing) and consume (client) share one runtime slot, and both report running — so consuming a peer's compute wrongly lit the Share toggle.
  • Toggle is now mode-aware: serve = sharing (on), client = consuming (off, disabled with an explanatory line).
  • Backend guard: mesh_stop_node refuses to tear down a client node, so a stale UI can't kill a consume session.
  • A failed serve node still occupies the slot, so it reads as sharing and stays turn-off-able (no dead-end).
  • Pure predicate + serde-contract + lifecycle tests; e2e regression proven red→green.

2. Surface who is using shared compute on the Share card

  • Read-only mesh_serving_usage command projects the node's own routing_metrics (inflight, tokens served, tok/s, and the local-vs-remote/endpoint split that distinguishes your agent from a peer consuming your compute).
  • Small indicator under the Share status line: idle / serving your agent / in use by another member.
  • No new trust surface — just exposes what the runtime already computes. Stubbed for non-mesh builds. Unit + e2e coverage.

3. Resync the Share model field when the served model changes

  • The card mirrored the node's modelId into the field only when the field was empty, so switching models (node restarts on the new one) left a stale model shown.
  • Now syncs whenever the served model differs from the field. Safe from clobbering a mid-edit because the field is disabled while the slot is occupied.

4. Deliver plain-text replies when the model skips the send tool (buzz-acp)

  • buzz-agent's output is its tool calls; streamed assistant content is observability-only and normally never posted. Capable models reliably call buzz messages send, but weaker local models (e.g. via shared compute) often answer conversationally in plain content and never call the send tool — silently dropping the reply.
  • Content-delivery fallback in buzz-acp: track per-turn whether the model published its own message + buffer streamed content; on a normal turn end with content but no publish tool call, post it as a threaded kind-9 reply (reuses buzz_sdk::build_message, signed with agent keys, best-effort, mirroring post_failure_notice).
  • Skips bare acknowledgements the base prompt forbids publishing. No prompt changes.
  • Live-validated against a small Gemma on a real community: fallback fires when the model answers in prose, stays dormant when it calls the send tool. Unit tests cover send-tool detection (incl. read-vs-send) and bare-ack filtering.

Testing

  • Rust: predicate/serde/lifecycle unit tests + buzz-acp fallback tests (all green); clippy + fmt clean.
  • Frontend: predicate + serving-usage unit tests, e2e regression specs.
  • Manual: full serve lifecycle (on → serve/route agent → clean stop → cache-backed restart) and both fallback branches exercised live on the meshllm community.

micspiral avatar Jul 23 '26 01:07 micspiral

almost there....

micspiral avatar Jul 23 '26 16:07 micspiral

one missing piece sometimes blocks the connection... standby...

micspiral avatar Jul 23 '26 16:07 micspiral

OK this is now confirmed to work end to end. THere will be more holepiunch improvements coming, they dont need to block this however, as this will unblock people.

micspiral avatar Jul 24 '26 01:07 micspiral

Reviewed at head e07638b87 (all CI green; cargo test -p buzz-acp 594/0 locally at exact head).

Parts 1–3 (toggle, usage indicator, model resync): clean, ship-ready. The deriveMeshShareToggle predicate + authoritative backend guard in mesh_stop_node (mode check under the lock, client node left untouched, config save skipped) handle the failed-serve-occupies-slot nuance correctly, and the e2e regression pins it. Serving usage is a genuinely read-only projection with defensive extraction. Model resync can't clobber a mid-edit (field disabled while slot occupied) and can't loop.

Part 4 (content-delivery fallback): right concept, but the publish detection is too narrow, and the miss direction is user-visible double-posting.

tool_call_is_message_publish substring-matches "messages send" in title+rawInput. A common publish pattern — the one agents are taught for content containing backticks — is Python argv: subprocess.run(['buzz','messages','send',...]). Serialized rawInput contains 'buzz','messages','send' with no "messages send" substring → detection misses. Same for wrapper scripts. Consequence: a capable model that narrates between tool calls (streamed agent_message_chunks) and then publishes via argv gets turn_sent_message=false, and the fallback posts the entire concatenated turn narration as a second channel reply. That's every desktop-managed agent on this harness that publishes this way, not an edge case.

Related: a deliberate-silence turn (base prompt: "silence is usually correct") that streamed any assistant text gets that text force-posted; the ≤40-char bare-ack list doesn't cover, e.g., "Nothing new here, ending the turn."

Two fixes, either sufficient, both better together:

  1. Broaden detection — normalize the haystack (strip quotes/commas/brackets, or token-match buzz + messages + send), and/or detect from tool_call_update output: the send response envelope {"accepted":true,"event_id":...} is a much stronger signal than the input.
  2. Scope-gate the fallback to sessions on local/mesh model profiles (the PR's own motivation), or behind a config flag — eliminates the capable-model blast radius entirely.

Minor:

  • The mesh-llm pin moves tag v0.73.1 → rev c441ea7 (= v0.73.1 + 1 commit, "owner-control listener must not share the mesh relay slot"). Worth naming in the PR body — it's an undisclosed dep bump.
  • Detection counts a failed send (nonzero exit) as delivered — fail-safe vs the status quo, fine.

Mechanics of the fallback are otherwise correct: EndTurn-only, take-once semantics mean no double-fire across the two EndTurn arms, and cancelled/truncated turns can't leak partial text.

Verdict: parts 1–3 mergeable today; part 4 needs the detection fix or the scope gate first.

tlongwell-block avatar Jul 24 '26 03:07 tlongwell-block

thanks @tlongwell-block - on 4 now. and yeah it will go to a released version in future for sure (which will have may other fixes and split model support for frontier class, another day).

(writing by hand old school)

micspiral avatar Jul 24 '26 03:07 micspiral

@tlongwell-block this looks good to me now - I am not happy with any approach I have found for scoping it yet, so one of those sufficient fixes I think makes it worth it, so up to you if/when to include it (am having an agent have oner more look)

micspiral avatar Jul 24 '26 05:07 micspiral

@tlongwell-block decoupled the prose capture into PR #2681 to get it out of this - hope that makes sense

micspiral avatar Jul 24 '26 05:07 micspiral