Close the account lifecycle leftovers: atomicity, bootstrap lock, redeem guard, credential delivery #192

Merged
weichen merged 1 commits from feature/svc-account-hardening into main 2026-10-13 06:07:33 +00:00
Owner

Why: 合同遗留项与 KTD12/KTD14——并发建号不覆盖、首管引导跨进程串行、兑换退避跨实例共担、撤销 API key 断流 SSE、CLI 凭据 env-DSN 与 0600 文件交付。

Evidence: go test ./... 绿(SELF worktree);新测试覆盖并发建号 1胜15拒、并发引导单管理员+拒绝接管、双 Store 连接共享限流、key 撤销后复验窗口内断流、HTTP 429;CI 为 GATE(test-pg 覆盖真库并发)。

Impact: 迁移 v29(redeem_attempts);CreateAccount 原子 INSERT;BootstrapFirstAdmin 咨询锁/复查单事务;SSE 复验覆盖 API key;CLI 增 AGENT_SYSTEM_DSN 与 --out。

Refs: Dev docs/svc-deploy/2026-10-13-login-recovery-contract.md;KTD12/KTD14/R5/R11。

Why: 合同遗留项与 KTD12/KTD14——并发建号不覆盖、首管引导跨进程串行、兑换退避跨实例共担、撤销 API key 断流 SSE、CLI 凭据 env-DSN 与 0600 文件交付。 Evidence: go test ./... 绿(SELF worktree);新测试覆盖并发建号 1胜15拒、并发引导单管理员+拒绝接管、双 Store 连接共享限流、key 撤销后复验窗口内断流、HTTP 429;CI 为 GATE(test-pg 覆盖真库并发)。 Impact: 迁移 v29(redeem_attempts);CreateAccount 原子 INSERT;BootstrapFirstAdmin 咨询锁/复查单事务;SSE 复验覆盖 API key;CLI 增 AGENT_SYSTEM_DSN 与 --out。 Refs: Dev docs/svc-deploy/2026-10-13-login-recovery-contract.md;KTD12/KTD14/R5/R11。
weichen added 1 commit 2026-10-13 06:05:56 +00:00
Why: The login recovery contract leftovers and KTD12/KTD14 require:
concurrent same-name account creation must not overwrite the winner,
first-admin bootstrap must serialize across processes, the redeem
endpoint backoff must be shared across instances, revoked API keys
must close established SSE streams, and CLI credentials need an
env-DSN path plus a non-interactive 0600 file delivery mode.

Evidence: go test ./... green; new tests cover 16-way concurrent
create (1 win/15 conflict, winner credentials intact), 8-way
concurrent bootstrap (single admin, refuse takeover after), redeem
guard shared across two store handles on one DB, SSE stream closed
after key revocation within the recheck window, and HTTP 429 after
the failure cap (SELF worktree run; CI is the GATE, PG via test-pg).

Impact: Migration v29 (redeem_attempts); CreateAccount becomes a
single-row INSERT with unique-violation conflict; BootstrapFirstAdmin
advisory-locks (PG) / rechecks (SQLite) and commits admin+key+audit in
one transaction; SSE revalidation covers API-key streams; redeem
backoff moves to the shared DB; CLI gains AGENT_SYSTEM_DSN fallback
and --out file delivery for create/reset-password/issue-login-key/
bootstrap-admin.

Refs: docs/svc-deploy/2026-10-13-login-recovery-contract.md leftovers;
proposal r2 KTD12/KTD14/R5/R11.
weichen merged commit cfb8308895 into main 2026-10-13 06:07:33 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#192