bug(event): Task v2 consumer blocked by console_event_published after successful launcher setup and app release

Open
#2,833 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start with internal/appmeta/app_version.go and cmd/event/consume.go, then trace the Task v2 event definitions and RequiredConsoleEvents check. Reproduce the reported case with the stub app-version response and compare it with a real published-version response if available. Done means diagnosing why the event is reported blocked and improving diagnostics or validation without silently bypassing subscription checks.

Written by the indexing model from the issue text.

Description

bug domain/core domain/event domain/task

问题

macOS 上 @larksuite/cli 1.0.97 的任务事件消费者此前能够持续连接,系统重启后每次启动都被 console_event_published 拦截。通过 CLI 提供的 launcher 入口完成配置(界面提示成功)并发布新的应用版本,仍不能恢复。

已验证的现象

  • lark-cli --profile <existing-profile> event consume task.task.update_user_access_v2 --as bot --dry-run 返回:凭据和 scope 检查通过,但 console_event_published=blocked,理由为 requires event types not subscribed in console: task.task.update_user_access_v2。
  • 读取 /open-apis/application/v6/applications/<app_id>/app_versions?lang=zh_cn&page_size=20 成功;最新已发布版本以及几个历史已发布版本的 event_infos 都不含该事件。最新两版含其他 Task v1 事件,但缺上述 Task v2 事件。
  • 本地保留的 2026-10-12 dry-run 记录中,该项明确为 ok、总决策为 ready,随后真实消费者连接并收到事件。该记录不是元数据读取失败后显示 unknown 的情形。
  • 没有保留当时的原始 app_versions 响应,因此不能判定是平台事件清单返回变化、配置同步/发布问题,还是 CLI 对该事件的订阅前置要求有误。这里不将推断当作已确认根因。

源码核对

FetchCurrentPublished 读取前两条应用版本,选首个 status=1 且 publish_time 非空的版本,并只从 event_infos 构造 EventTypes:
https://github.com/larksuite/cli/blob/72579c80027c863ca51d5f9affda72a70ab0d8a6/internal/appmeta/app_version.go#L28-L82

consume 对成功读取但缺目标事件的版本会阻断;读取或解析失败才跳过弱依赖的 console 预检:
https://github.com/larksuite/cli/blob/72579c80027c863ca51d5f9affda72a70ab0d8a6/cmd/event/consume.go#L149-L160

核对 v1.0.98:相关事件比较与 Task 事件定义未改变;app_version.go 的修改主要是 scope token_types 缺失/null 的处理。

无凭据的判定复现

给 appmeta 的 StubAPIClient 返回以下合成数据:

{"code":0,"data":{"items":[{"version":"1.0.5","status":1,"publish_time":"1","event_infos":[],"scopes":[]}]}}

FetchCurrentPublished 返回非 nil 版本,但 EventTypes 为空,Task 定义的 RequiredConsoleEvents 比较将其拦截。省略 event_infos 同样如此。这个合成复现只证明当前判定逻辑,并不能证明真实平台响应是否正确。

希望确认

  1. Task v2 的 user-access 事件通过任务订阅 API 注册;其 console 预检是否必须、且能可靠地从 app_versions.event_infos 得到?
  2. launcher 提示配置成功并发布后仍缺此项时,支持的恢复路径是什么?
  3. 能否在诊断中输出所选应用版本及该类动态订阅的实际状态,以区分缺订阅、元数据缺失和读取失败?希望保留真实权限/订阅检查,而不是提供静默绕过。

为保护用户隐私,此反馈不附 app ID、凭据、回调地址、任务 ID/正文或本机日志。重复检索仅找到相关但不同的 #2284(typed 评论读取/section 监听)。

Dominant language
Go
Stars
18.2k
Forks
1.4k
Avg merge
1d 3h
Merged PRs (30d)
18

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from larksuite/cli

All issues in larksuite/cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.