Repository navigation
feat(setup): 首次扫码后复用登录态创建机器人 - #457
Merged
Merged
Conversation
Owner
Author
独立 review 结论(Claude):无 P0/P1,可合并基于 head
非阻塞建议(P2,不影响合并)
放行:以上两点均非阻塞,同意合并。 |
Owner
Author
增量复审(head
|
| 复审点 | 结论 |
|---|---|
| 展示身份与 create 是否绑定同一 cookie / TOCTOU | 无错租户窗口。createOpenPlatformApiClient(prepared.cookies) 构造出的 client 持有 cookie 内存快照;身份读取(/app 提取 window.user)与 upload/image+app/create 用的是同一个 client 快照,磁盘缓存被并发覆盖不会改到内存快照。expectedIdentity(展示时钉住)在 POST 前再比对,不一致即 session_changed 中止——测试 expect(post).not.toHaveBeenCalled() 证实一个 POST 都不发。 |
| reuse/qr/失效/换号 四分流是否意外弹码 | 不会。reuse→disableQrLogin:true(缓存失效返回 invalid_session,不弹码);qr→forceQrLogin(明确扫码);失效→提示(Dashboard scan_required / CLI「登录态失效请 --switch-account」);换号→显式扫码。 |
--json stdout / 无缓存 / --switch-account 语义 |
纯净且正确。QR/身份全走 stderr;--json 无缓存→结构化 fail 要求 --switch-account,不弹码;仅 --switch-account 才扫码(QR 仍到 stderr,stdout 保持单行 JSON)。作者全新临时 HOME 实跑佐证:exit 1、stdout 单行 JSON、stderr 空、无 QR,与代码分流一致。 |
| partial recovery / owner fail-closed / 名称冻结回归 | 无回归。partial 恢复命令已补 --open-platform-auto(原 P2① 已修,3 处);owner 路径(preflight/needs_owner/submitOwner 落盘门)与名称冻结(resolveSetupAppName 流程起点)本次未触碰。 |
| Dashboard 文案/按钮是否明确确认而非静默复用 | 明确确认。表单展示「将使用 {user} · {tenant}」+「更换账号」;免扫提交按钮文案为「确认账号并免扫码添加」;scan_required 单列。前端下发的 expectedIdentity 即所展示身份,后端再对活体身份复核。 |
P2 阻塞判定(回应「P2 请明确是否阻塞合并」)
- P2①(partial 恢复命令加
--open-platform-auto):本 head 已修,闭环。 - P2②(needs_owner 无 Close/Cancel 入口,只能提交或刷新页逃逸):不阻塞。刻意 fail-closed,pending bot 不落盘、无数据风险,刷新即可逃逸。
- 新增小 nit(非阻塞):
/api/cli-options现每次开表单会同步做一次inspectCachedFeishuOpenPlatformSession(含 validate +/app两次外部 GET)。无缓存是本地快返;有缓存但飞书网络挂起时,表单会停在「正在检查登录状态…」且提交按钮禁用较久。网络错误会 catch 成scan_required快速降级,仅真 TCP 挂起才拖长——建议给该 pre-open inspect 加个短超时,纯体验优化,不阻塞。
结论:无 P0/P1,同意合并。 已在话题 @ 作者放行。
deepcoldy
marked this pull request as ready for review
July 13, 2026 13:11
This was referenced Jul 15, 2026
deepcoldy
added a commit
that referenced
this pull request
Jul 15, 2026
根因:v2.109(#457)起建 bot 走 Web app/create 建出「裸未启用」应用(appSceneType 0),默认零事件订阅、tenantAppStatus=0 企业内不可用。 修复(对齐手动 oneclick launcher,保持老流程只换第一步): - createOpenPlatformAppWithClient 首选 manifest/upsert_by_template(developer_console 模板,默认带 bot 能力/长连接/基础事件/card 回调),模板失败明确拒绝才 fallback app/create,outcome-unknown fail-closed - 第一步复刻 launcher:模板建完立刻用极简版本发布一次(可见范围含创建者)让应用 tenantAppStatus 0→2 上架启用;fail-closed(commit 失败/无 versionId 抛 CreatedOpenPlatformAppError 带 appId,不留未发布草稿) - automateOpenPlatformSetup 事件/回调走增量契约 + fail-closed;nextAppVersion 取所有版本含草稿最大 +1 防撞车;不再注入当前操作者到可见范围(避免扩大已有 bot 可见范围) 验证:codex 多轮二审全 PASS;setup 相关单测全绿;live e2e 真实租户 tenantAppStatus=2、事件/回调齐全、双长连接 PASS。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
userId / tenantId作为用户意图基线;真正创建时使用即将调用/developers/v1/app/create的同一份 cookie 再读一次身份,不一致就停止,绝不创建。botmux setup同样展示「账号 · 企业」,提供「确认并免扫码添加 / 更换账号」。--json缺少有效缓存时不会意外弹码,需显式--switch-account;stdout 保持纯 JSON。botmux-N。--open-platform-auto,重试不会重复建应用。接口确认
已核对用户给出的
https://open.larkoffice.com/page/launcher?from=backend_oneclick:登录后的页面前端使用同一套一键创建能力并定义/v1/app/create。Botmux 调用开发者后台对应的/developers/v1/app/create,随后执行 robot/event switch 与只读 secret 获取,不另走 SDK 注册。影响面
验证
pnpm build:通过。pnpm test:8015/8032 通过;17 项失败均为当前机器既有环境基线(公共 URL 13、时区 3、无关 CSS 断言 1),与本改动路径无关。pnpm switch:here && botmux restart/ 后续pnpm build && pnpm daemon:restart成功,全部 bot 与 Dashboard online。userId / tenantId,后端同 cookie 再比对;