feat(im): wire Feishu /project channel switching - #3708
Conversation
Signed-off-by: Leng <Lengjingxu@gmail.com>
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/im/feishu/adapter.ts | Enables the project-switching flow, but thereby exposes project card actions to stale group/topic callbacks that can fall back to the DM session. |
| apps/desktop/src/main/im/feishu/uiText.ts | Adds a complete Feishu project-card text pack matching the shared UI contract. |
| apps/desktop/src/main/im/feishu/tests/feishuAdapter.test.ts | Covers capability wiring, text shape, and session-ID derivation, but not lane loss between card creation and callback handling. |
Sequence Diagram
sequenceDiagram
participant U as Feishu user
participant F as Feishu transport
participant L as Lane registry
participant H as Project action handler
participant S as Session repository
U->>F: Click old project card
F->>L: Resolve card messageId
L-->>F: No lane after restart/eviction
F->>H: "senderId = operator open_id"
H->>S: Resolve route as DM session
H->>S: Switch DM working directory
H-->>U: Patch card as successful
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/main/im/feishu/adapter.ts:335
**旧卡片切错会话**
当桌面进程重启、Feishu 客户端重新绑定或 lane 缓存淘汰后,群聊或话题中的旧 `/project` 卡片无法恢复原 lane,回调会保留操作者的 `open_id` 并按私聊身份解析目标,导致项目操作切换私聊会话而非卡片所在的话题会话,同时卡片仍会显示切换成功。项目动作需要像现有 control 动作一样在群卡 lane 丢失时拒绝执行。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(im): wire Feishu /project channel s..." | Re-trigger Greptile
Signed-off-by: Leng <Lengjingxu@gmail.com>
|
@lengjingxu 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/im/feishu/adapter.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Leng <Lengjingxu@gmail.com>
|
这个 PR 会让飞书 /project 真正切换频道,已进入维护者确认,球不在作者手里。 请维护者直接在 PR 上 Approve;需要修改就 Request Changes。讨论 issue:#3719 |
What
Wire Feishu channel
/projectcommand by settingprojectSwitching: trueand providing thecards.projectUI text pack in the Feishu adapter.Fix: reject stale group-card /project switches when lane mapping is lost (app restart) — fail closed like existing /ctr control actions.
Why
Resolves the Feishu side of #3704 — the shared
/projectslash command and card action handler are already in place, but the Feishu adapter had not opted in. This commit enables it with the required Chinese UI copy.Greptile flagged that a stale group card callback could fall back to the operator open_id and switch the DM session instead of the topic lane. Fixed in 229d0d8 by adding the same
isGroupCardWithLostLaneguard used by control actions.Changes (2 commits, 5 files, +118)
feat(im): wire Feishu /project channel switching (4b7845e)
apps/desktop/src/main/im/feishu/adapter.ts— setprojectSwitching: trueapps/desktop/src/main/im/feishu/uiText.ts— addcards.projecttext packapps/desktop/src/main/im/feishu/__tests__/feishuAdapter.test.ts— 3 tests (flag on, text shape, lane isolation)fix(im): reject stale group-card /project switches when lane is lost (229d0d8)
apps/desktop/src/main/im/shared/cardActionHandler.ts—isGroupCardWithLostLaneguard on project:switch path;rejectStaleGroupCardaccepts optional bodyapps/desktop/src/main/im/shared/types.ts—cards.project.staleGroupCardoptional fieldapps/desktop/src/main/im/feishu/uiText.ts— staleGroupCard copyapps/desktop/src/main/im/shared/__tests__/cardActionGroupLaneGuard.test.ts— 3 tests (pick fail-closed, dialogue fail-closed, topic lane not falsely blocked)Verification
npx vitest run src/main/im— 62 files / 664 tests all passpnpm --filter desktop typecheck— 0 errorspnpm check:dco— 2 commits signedDash checklist coverage
listProjectsForControl()+buildProjectPickerCardswitchSessionWorkingDirclears +disposeOneSessionproject:dialoguepathswitchSessionWorkingDironly touches workingDir + workspaceKindfs.statSync().isDirectory()guardproject:cancel+attachedUnsupportedfallbackisGroupCardWithLostLaneguard (same as /ctr)Notes
main(865ccfb). Coordination with feat(desktop): support Feishu bot working directories #2624 (Feishu working-dir config) will be a follow-up small PR if needed.Related: #3704
Depends on: #2624 (soft — no merge conflict on main today)