fix(desktop): scope -32001 mesh denial copy to mesh agents - #4273
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): scope -32001 mesh denial copy to mesh agents#4273iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
When a managed agent's underlying LLM call returns 401/403, buzz-agent classifies it as JSON-RPC -32001 and the desktop previously rewrote that to "Community access denied this agent — check its community membership." for every agent, regardless of provider. That misleads the "Local OpenAI-compatible" lane where the 401 came from the user's own upstream (e.g. llama.cpp started with `--api-key`): the reporter's actual fix is "your configured key doesn't match the server's", but the rewritten copy points them at community membership — an unrelated codepath (see block#4205). `friendlyAgentLastError` and `friendlyTurnErrorCopy` now accept the agent's configured LLM provider and only substitute the mesh copy when `provider === "relay-mesh"`; all other providers keep the raw error verbatim. The legacy string fallback for pre-code records (`"llm auth:"` prefix) gets the same gate so the conservative behavior is consistent. Callers in ManagedAgentRow and UnifiedAgentsSection thread `agent.provider` through. Tests mirror the reporter's lane (non-mesh + -32001 → preserved) and the mesh case stays regression-tested. http://github.com/block/buzz/issues/4205 Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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
When a managed agent's underlying LLM call returns 401/403,
buzz-agentclassifies it as JSON-RPC-32001(AgentError::LlmAuth, crates/buzz-agent/src/types.rs:390). The desktop supervisor recovers that intoManagedAgent.lastErrorCodeandfriendlyAgentLastErrorrewrites every-32001toRELAY_MESH_DENIED_COPY = "Community access denied this agent — check its community membership.", regardless of provider.That's wrong for non-mesh agents whose 401 came from their own upstream (their own llama.cpp, api.openai.com with a bad key, a Databricks host, …). The reporter in #4205 runs a Local OpenAI-compatible agent against llama.cpp at
127.0.0.1:8082; llama.cpp rejected with{"message":"multi-user-authorization"}(its multi-user key mismatch), and Buzz rewrote that to "Community access denied" — pointing the reporter at the wrong codepath entirely.This PR makes the rewrite provider-aware: only
provider === "relay-mesh"gets the mesh copy; other providers keep the raw error verbatim so the reporter sees the actionable upstream message. The legacy pre-code string fallback ("llm auth:"prefix) gets the same gate.Changes
desktop/src/features/agents/lib/friendlyAgentLastError.ts: add optionalproviderparam; gate-32001rewrite and the legacy-string fallback onprovider === "relay-mesh".friendlyTurnErrorCopygains a matching optional provider param and threads it through.desktop/src/features/agents/ui/ManagedAgentRow.tsx,UnifiedAgentsSection.tsx: passagent.provider.-32001→ preserved raw message, not mesh copy) plus null-provider conservative passthrough. Existing mesh-denied tests kept by passing"relay-mesh"explicitly.agentSessionTranscript.ts(transcript path) doesn't have agent metadata handy and now falls through to raw for all providers, which is the conservative direction — better more detail to a mesh user than less to a non-mesh one.Tests
desktop/node --import ./test-loader.mjs --experimental-strip-types --test "src/features/agents/lib/friendlyAgentLastError.test.mjs"→ 36/36pnpm exec tsc --noEmitcleanWhy not change the agent instead
The
-32001code is correct — it really is an auth failure. The bug was purely in the desktop rewriting layer claiming all 401s are community-gating. Mesh's specific copy stays valuable for mesh agents, where "community membership" really is the next thing to check.Fixes #4205
Signed-off-by: Sarthak Singh sarthak.singh@juspay.in