Skip to content

Agent Mesh

bridge: fix skill doc inaccuracies and keep task identity on save failures

Tomas Tormo0b25b3754131
diff --git a/agents/skills/sam-a2a-bridge/SKILL.md b/agents/skills/sam-a2a-bridge/SKILL.md
index daac1db1..0e45d31e 100644
--- a/agents/skills/sam-a2a-bridge/SKILL.md
+++ b/agents/skills/sam-a2a-bridge/SKILL.md
@@ -32,10 +32,9 @@ Propose each shell command and let the user approve it before running anything.
path before continuing.
2. Build the bridge (own Go module, Go >= 1.25):
`cd <sam-repo>/cmd/sam-a2a-bridge && go build -o ~/bin/sam-a2a-bridge .`
-3. Register it with the harness, passing the sidecar URL, its API token, and
- the download directory for agent-returned files:
- `claude mcp add sam-a2a-bridge -- ~/bin/sam-a2a-bridge -url http://localhost:8080 -token <sidecar-token> -download-dir ~/.sam/a2a-downloads`
- (Files are saved under the download directory; the default is `~/.sam/a2a-downloads` and the user prunes manually.)
+3. Register it with the harness, passing the sidecar URL and its API token:
+ `claude mcp add sam-a2a-bridge -- ~/bin/sam-a2a-bridge -url http://localhost:8080 -token <sidecar-token>`
+ (Agent-returned files land in `~/.sam/a2a-downloads` by default, auto-created; pass `-download-dir` to change it — you must create that directory yourself. No auto-cleanup; prune manually.)
4. Restart the harness session; the three tools appear.
## Check Agent Capabilities
@@ -64,8 +63,8 @@ input schema) and `file_path` attachments appropriately.
- `message` is plain text.
- `data` is a JSON object; it becomes a DataPart and routes to the agent's
structured-input handler. Check `default_input_modes` first.
- - `file_path` and `file_name` attach a local file (up to 5 MB). Both must be
- provided together. The agent receives the file as an attachment.
+ - `file_path` attaches a local file (up to 5 MB); `file_name` optionally
+ renames what the agent sees (default: the file's base name).
- The call returns immediately with `{"task_id", "context_id", "state", "text",
"data"?, "files"?}` — it never blocks on the agent.
- `data` (optional) contains structured JSON returned inline.
diff --git a/cmd/sam-a2a-bridge/a2a.go b/cmd/sam-a2a-bridge/a2a.go
index ea57ab89..62889950 100644
--- a/cmd/sam-a2a-bridge/a2a.go
+++ b/cmd/sam-a2a-bridge/a2a.go
@@ -246,7 +246,7 @@ func (r *taskResult) collect(cfg bridgeConfig, taskID string, parts a2a.ContentP
if b := part.Raw(); b != nil {
path, err := saveFilePart(cfg.downloadDir, taskID, part.Filename, b)
if err != nil {
- return err
+ return fmt.Errorf("task %s: saving returned file: %w", taskID, err)
}
r.Files = append(r.Files, path)
}
diff --git a/cmd/sam-a2a-bridge/a2a_test.go b/cmd/sam-a2a-bridge/a2a_test.go
index dd702600..1268b298 100644
--- a/cmd/sam-a2a-bridge/a2a_test.go
+++ b/cmd/sam-a2a-bridge/a2a_test.go
@@ -353,3 +353,22 @@ func TestGetAgentCardTrims(t *testing.T) {
t.Fatalf("trim failed, security/provider material leaked: %s", raw)
}
}
+
+func TestResultErrorIncludesTaskID(t *testing.T) {
+ fileB64 := base64.StdEncoding.EncodeToString([]byte("file content"))
+ task := `{"kind":"task","id":"t99","contextId":"c99","status":{"state":"completed",` +
+ `"message":{"kind":"message","messageId":"m1","role":"agent","parts":[` +
+ `{"raw":"` + fileB64 + `","filename":"test.txt","mediaType":"text/plain"}]}}}`
+ srv := fakeSidecar(t, "/sam/12D3KooWpeer/a2a/echo", `{"task":`+task+`}`, nil)
+ defer srv.Close()
+
+ _, err := sendAgentTask(context.Background(),
+ bridgeConfig{sidecarURL: srv.URL, downloadDir: "/nonexistent-dir-xyz"},
+ sendAgentTaskParams{Peer: "12D3KooWpeer", Service: "echo", Message: "go"})
+ if err == nil {
+ t.Fatal("error expected when download dir does not exist")
+ }
+ if !strings.Contains(err.Error(), "task t99") {
+ t.Errorf("error must include task ID; got: %v", err)
+ }
+}