bug: JSON-RPC errors drop the server's 401 and 503 message, showing only the HTTP status

Đang mở Phù hợp với người mới
#158 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, json
Lĩnh vực
api

Hướng nghiên cứu

Client JSON-RPC trong a2aclient/jsonrpc.go (khoảng dòng 124-125 và 156-157) trả về ngay với mọi trạng thái khác 200 mà không đọc body, và nguyên nhân nằm ở dependency a2a-go v2.6.0. Hãy bắt đầu bằng việc kiểm tra go.mod, rồi nâng a2a-go lên phiên bản mà FromHTTPError trong internal/jsonrpc có phân tích body của lỗi. Hoàn thành khi a2a send gặp 401 hoặc 503 in ra thông điệp từ server thay vì chỉ mã trạng thái HTTP, khớp với đầu ra của --transport rest.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Over the default JSON-RPC transport, a2a send and a2a task list print only unexpected HTTP status: 401 Unauthorized or 503 Service Unavailable. They drop the server's error message, so a new user gets no instruction from the CLI.

Repro (against a2a-serve)

a2a send -a "$URL" "hi"                     # no token, or a revoked or rotated pairing
a2a send -a "$URL" --transport rest "hi"

Expected

The server's A2A error, which a2a-serve sends in the 401 body: this agent needs a token: on the machine running the agent, enable the credential helper of a2a-serve (run a2a-serve doctor --fix); elsewhere, ask the agent's owner for a pairing code and run a2a-serve pair join ``. For 503: "the server is busy; try again later".

Actual

Error: failed to send message: unexpected HTTP status: 401 Unauthorized (exit 1; -o json gives A2ACLI_ERR_INTERNAL), also with -v. --transport rest prints the full hint. This hits example 01 of a2a-serve when a2a-serve doctor --fix was skipped, and every member whose pairing was rotated or removed. It reproduced in 3 lanes, more than 10 times in total.

Cause

a2a v0.4.0 is built with a2a-go v2.6.0 (go version -m). Its JSON-RPC client (a2aclient/jsonrpc.go:124-125, :156-157) returns on any non-200 status without decoding the body. Newer a2a-go parses it in internal/jsonrpc/jsonrpc.go:150-164 (FromHTTPError), so bumping a2a-go should fix it.

Found by user simulation (tools/sim) at 1b67edf.

Ngôn ngữ chính
Go
Star
181
Fork
28
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
22

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của a2aproject/a2a-cli

Tất cả issue của a2aproject/a2a-cli

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.