Skip to content

Lark manager: decouple context capture from Turn authority #4318

Description

@huangruiteng

Problem / 问题

The manager route currently resolves decide_manager_event() before creating or ingesting its runtime inbox event. Any group message that is in the configured manager chat but lacks a provider-native mention or a verified reply is returned as not_addressed and disappears from the manager's durable context.

管家路由目前先执行 decide_manager_event(),之后才创建并写入运行时 inbox。因此,位于已配置管家群但缺少 provider 原生 mention 或 verified reply 的消息会以 not_addressed 被丢弃,不会进入管家的持久上下文。

This is observable with rich-text messages whose rendered text contains @ but whose provider payload contains no matching at node. The strict authority check is correct, but using it as the capture gate is too brittle: visibility and execution authority are different decisions.

富文本消息可能显示 @,但 provider payload 中并没有匹配的 at 节点。严格的权限判断是正确的,但不应同时充当采集开关:可见性与执行权限应是两个不同决策。

Proposed contract / 建议契约

  1. For one unambiguous, enabled manager chat binding, persist bounded non-self group messages as context-only material, even when they are not addressed to the bot.

  2. Only provider-native mention, verified reply-to-bot, or another existing typed authority record may start/steer a manager Turn or mutate Goal/Todo state.

  3. A later authorized manager Turn may read a bounded recent context window, with every item explicitly marked non-authoritative. It must not reinterpret those items as standalone commands.

  4. Context-only items require an idempotent review/consumption receipt. They must not trigger a Lark reply, reaction, source ACK, or model call on their own.

  5. Preserve target/chat/Goal isolation, self-message filtering, stable ordering, restart recovery, duplicate delivery safety, and content-free health projections.

  6. 对唯一且启用的管家群绑定,持久化有界的非机器人群消息为 仅上下文材料,即使消息没有明确 @ 机器人。

  7. 只有 provider 原生 mention、已验证的 reply-to-bot 或其他既有 typed authority 记录,才能启动/steer 管家 Turn 或修改 Goal/Todo。

  8. 后续获得授权的管家 Turn 可以读取有界的近期上下文窗口,但每条材料必须明确标记为非权威,且不得被重新解释成独立指令。

  9. 仅上下文材料需要幂等 review/consumption receipt;它自身不得触发 Lark 回复、reaction、source ACK 或模型调用。

  10. 保持 target/chat/Goal 隔离、自消息过滤、稳定排序、重启恢复、重复投递安全和无正文的健康投影。

Acceptance / 验收

  • An unaddressed message in the configured manager chat is durably captured and reported as context_only_captured; answer, reply, reaction and source ACK are not called.

  • A subsequent native mention receives a bounded prior-context packet plus the addressed message; only the addressed message grants Turn authority.

  • A message in another chat, a self message, or an ambiguous manager binding remains rejected and is not captured.

  • Duplicate events and restart recovery do not duplicate context or replies.

  • CLI/managed Turn, frontend and Lark expose the same typed capture/authority distinction and readback; no second configuration source is introduced.

  • Documentation and contract changes are bilingual.

  • 已配置管家群中的未寻址消息会被持久化,并返回 context_only_captured;不得调用 answer、回复、reaction 或 source ACK。

  • 后续原生 mention 会收到有界历史上下文和当前寻址消息;只有当前寻址消息授予 Turn 权限。

  • 其他群、自消息或多重歧义的管家绑定仍应拒绝且不采集。

  • 重复事件与重启恢复不得产生重复上下文或重复回复。

  • CLI/managed Turn、frontend 与 Lark 展示同一份 typed capture/authority 区分与回读,不新增第二配置源。

  • 文档与契约默认双语。

Boundaries / 边界

This issue does not authorize ordinary group chat to mutate LoopX, does not weaken native mention/reply verification, and does not replay historical messages automatically.

本问题不授权普通群聊修改 LoopX,不降低原生 mention/reply 校验,也不自动重放历史消息。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions