根因(对接方反复报的"用着用着登录已过期"): - 竞态:bootstrap 的"过期前 60s 自动刷"定时器直接调 refreshToken(),绕过 api-client 的 单飞锁 → 定时器与请求 401 兜底刷可能同时拿同一个一次性 refresh token 去换 → 一个成功 轮换(del 旧 jti),另一个拿已作废 jti → 10103 revoked → 误清会话。 - 盲区:api-client 运行期 clear() 路径无 client-diag 信标 → 服务端无日志、不触发企微告警。 改动: - lib/auth-diag.ts:抽出共享诊断信标(bootstrap 与 api-client 共用)。 - api-client.ts:两个 clear 点(refresh 被拒 / 受保护请求鉴权失败)补运行期掉线信标。 - use-auth-bootstrap.ts:过期定时器改走共享单飞 tryRefresh,消除双刷竞态。 - auth.service.ts:clientDiag 告警门控纳入 runtime-refresh-fail / runtime-auth-clear, alertSessionExpiry 增运行期根因文案与标题。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| cli | Loading commit data... | |
| common | Loading commit data... | |
| config | Loading commit data... | |
| modules | Loading commit data... | |
| openapi | Loading commit data... | |
| prisma | Loading commit data... | |
| queues | Loading commit data... | |
| redis | Loading commit data... | |
| types | Loading commit data... | |
| app.module.ts | Loading commit data... | |
| health.controller.ts | Loading commit data... | |
| main.ts | Loading commit data... |