agentmesh-node run fails on restart when --bootstrap-token-path is still set

Đang mở
#956 0 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 1 ngày

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
56/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

Hướng nghiên cứu

Start with cmd/agentmesh-node/main.go at the token resolution around line 320 and the stored identity branch around line 474. Trace how the control plane URL and stored identity are checked, then run the node enrollment tests. Done means a node can restart with the spent token, stay healthy, and retain the same PeerID; explicit reset and mesh switching should still re-enroll.

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

Mô tả

A node enrolled with a single-use token can't restart with the same command line:

agentmesh-node run --control-plane http://127.0.0.1:8090 --bootstrap-token-path tok --data-dir ./n1   # first run: OK
# stop it, then run the identical command again:
agentmesh-node run --control-plane http://127.0.0.1:8090 --bootstrap-token-path tok --data-dir ./n1
# FATAL ... Bootstrap token max usages exceeded

Dropping --bootstrap-token-path brings the same peer back healthy with its stored identity.

Cause: cmd/agentmesh-node/main.go:320 resolves the token file into bootstrapTokenFlag. The stored-identity branch at :474 only runs when jwtStr == "" && bootstrapTokenFlag == "". A token on the command line therefore always forces re-enrollment, even when a valid identity for the same control plane is already stored.

This bites anything that starts nodes from a fixed command line or unit file: systemd, scheduled tasks, Kubernetes args. The token is spent after the first boot, and every restart after that fails.

Proposal:

  • If a stored identity exists for the same control plane URL, use it, and log that the supplied bootstrap token was not used.
  • Keep explicit re-enrollment unchanged: agentmesh-node reset, or --join when switching meshes.
  • Add a regression test: enroll, restart with the spent token, and expect a healthy node with the same PeerID.

Happy to send the PR if this direction works for you.

Ngôn ngữ chính
Go
Star
1.2k
Fork
207
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
85

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 google/agentmesh

Tất cả issue của google/agentmesh

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.