You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI quản lý accounts: auth login --add, auth list (tĩnh), auth remove #2
Quản lý nhiều account từ CLI, end-to-end: login thêm acc mà không ghi đè acc cũ, xem danh sách, xóa acc.
zcode-proxy auth login <provider> --add: chạy OAuth như cũ nhưng thêm account (upsert theo account key) thay vì ghi đè primary. In ra id + label của account vừa thêm.
zcode-proxy auth list: bảng thông tin tĩnh — id, label, userId (che bớt giữa), có phải primary không, addedAt, tokenExpiresAt (decode JWT exp/age;JWT start-plan không có exp → hiện iat + age). Không có cột status/quota — status runtime thuộc pool (ticket 2a), quota thuộc poller (ticket 4); cột đó thêm ở ticket 4.
zcode-proxy auth remove <id>: xóa 1 account (không được xóa acc cuối nếu làm mất khả năng serve — hỏi xác nhận), re-point primary nếu cần.
auth logout giữ nguyên behavior cũ: chỉ xóa primary account.
--add phải dùng đúng lockfile protocol của store (acquire → read latest → modify → write → release) — acc thêm từ CLI khác phải thấy được bởi server đang chạy qua hot-reload.
Acceptance criteria
auth login --add 2 acc khác nhau → store có 2 entries, primary là acc mới nhất
auth login --add 2 lần cùng 1 acc → upsert, không duplicate
✅ Subprocess tests: real bun run src/index.ts trên temp store — masking, không credential trên stdout, refusal cases, primary re-point, loadCredential() resolution
✅ Pool hot-add test: CLI process ghi store → pool nhận trong sync timer, acc mới tham gia rotation
Suite: local 1230/0, container 1231/0 (merged master).
Docs: docs/multi-account.md — cách thêm acc, strategy, states, bảng lỗi→hành động, giới hạn đã chấp nhận (async job không failover, single-acc pass-through).
E2E 2 acc thật: chưa chạy được — acc thứ hai quota rỗng (đã xác nhận trước đó). Việc claim tay trên web là việc của mày; auto-claim multi-acc vẫn nằm ngoài plan. Khi acc thứ hai có quota, chạy: vài request qua proxy + xem phân phối và header x-zcode-account (debug on).
Activity
longphamdev commentedon Nov 9, 2026
Implementation constraint (merge-order + API):
saveAccount/upsert trực tiếp, KHÔNG qua facadesaveCredential— facade đang có bug ghi đè primary mà Phase 1 hardening: golden KDF test, facade saveCredential match theo userId, .bak/lock polish #1 đang fix.store.ts/accounts.tsnên song song với Phase 1 hardening: golden KDF test, facade saveCredential match theo userId, .bak/lock polish #1 dễ conflict.--adddính bug facade (ghi đè primary thay vì upsert đúng entry) → đó là bug của Phase 1 hardening: golden KDF test, facade saveCredential match theo userId, .bak/lock polish #1, report về Phase 1 hardening: golden KDF test, facade saveCredential match theo userId, .bak/lock polish #1, không workaround trong CLI quản lý accounts: auth login --add, auth list (tĩnh), auth remove #2.longphamdev commentedon Nov 9, 2026
Đóng nhầm — reopen ngay (xem comment sau).
longphamdev commentedon Nov 9, 2026
#2 hoàn thành. Commit
0445f2d(merged to master).Acceptance:
auth login --add: dùngsaveAccounttrực tiếp (không facade), output ADDED/UPDATED theo dedupe userId, hỗ trợ--labelauth remove <id|label>: primary removal re-point rõ ràng; acc cuối cần--yes; unknown id → error + exit 1auth logout: chỉ xóa primary (facade behavior giữ nguyên)auth list(Per-account quota poller + /quota schema {accounts, aggregate, legacy} #6) verified qua CLI subprocess thậtbun run src/index.tstrên temp store — masking, không credential trên stdout, refusal cases, primary re-point,loadCredential()resolutionSuite: local 1230/0, container 1231/0 (merged master).
Docs:
docs/multi-account.md— cách thêm acc, strategy, states, bảng lỗi→hành động, giới hạn đã chấp nhận (async job không failover, single-acc pass-through).E2E 2 acc thật: chưa chạy được — acc thứ hai quota rỗng (đã xác nhận trước đó). Việc claim tay trên web là việc của mày; auto-claim multi-acc vẫn nằm ngoài plan. Khi acc thứ hai có quota, chạy: vài request qua proxy + xem phân phối và header
x-zcode-account(debug on).longphamdev commentedon Nov 9, 2026
Đủ acceptance. Chuỗi multi-account: #1 #3 #4 #5 #6 #2 — tất cả closed. Docs tại docs/multi-account.md.
feat(cli): auth login --add/--label + auth remove (#2)
feat(config): accounts.pickStrategy — switchable pick strategy with s…