Skip to content

[bug] credentials list --output json returns null instead of stable empty schema #22

@mrgoonie

Description

@mrgoonie

Mô tả

Khi dùng goclaw credentials list --output json, CLI trả về null thay vì một JSON object/array rõ ràng.

Trong lúc debug timeout cho credentialed CLI (codex), agent cần list CLI credentials để tìm codex credential ID và update timeout_seconds bằng command:

goclaw credentials list --output json

Kết quả thực tế:

null

Điều này làm automation khó xử lý vì không rõ nghĩa là:

  • Không có credentials?
  • Không có quyền?
  • Sai profile/server/token?
  • API trả body rỗng?
  • CLI parse lỗi?

Expected behavior

--output json nên trả về schema ổn định, ví dụ:

{
  "items": []
}

hoặc nếu không có credential thì ít nhất:

[]

Nếu auth/profile/server sai hoặc không đủ quyền, CLI nên trả error rõ ràng với non-zero exit code, không trả null như success output.

Actual behavior

Command trả:

null

Không đủ thông tin để agent/human biết trạng thái thật.

Impact

  • AI automation không thể phân biệt empty result với lỗi config/auth.
  • Không thể tiếp tục flow update timeout cho credentialed CLI như codex nếu không lấy được credential ID.
  • Làm trải nghiệm debug bằng CLI bị mơ hồ.

Repro

goclaw credentials list --output json

Observed output:

null

Suggested fix

  1. Chuẩn hóa JSON output cho list command:
    • success empty: { "items": [] } hoặc []
    • success non-empty: cùng schema
  2. Nếu API response nil/empty bất thường, CLI nên emit error rõ ràng.
  3. Nếu profile/server/token chưa đúng, trả non-zero exit + message actionable.
  4. Bổ sung test cho credentials list --output json khi API trả empty list.

Context

Use case đang cần:

goclaw credentials list --output json
# find codex credential id

goclaw credentials update <credID> --body '{"timeout_seconds":300}'

Ngoài ra, goclaw credentials updategoclaw credentials agent-grants update đã có command phù hợp để set timeout, nhưng list output null làm bước discovery bị kẹt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions