Repository navigation
fix(chat): keep grant reads independent of Bot health scans - #8142
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
在工作区发布材料前核验授权的调用方,会被无关 Bot 的健康统计阻塞。 原接口同时扫描监听和投递历史;新读取视图只取当前绑定与工作区,保留原有发布前校验。 原本因健康读取失败而中断的授权核验,可以独立获得一次当前快照。 本 PR 不重放业务、不修复全部健康统计,也不宣称历史材料已经入库。 安装采用、项目 source adapter 切换及原助手的真实补办和回复,仍须各自验收。
改动思路 / Approach
在既有 HTTP 投影 owner 增加明确选择的轻量视图,比延长超时、读取私有状态文件或增加缓存更小,也保留默认设置页行为。 当前 PR 只交付可回滚的读取投影与真实 HTTP 反证,不增加消费者、后台执行器或持久授权。
读取投影仍取自 Core 的绑定和当前可用工作区。显式选择轻量视图后,不再调用监听健康、历史投递和 Agent 发现;无查询参数时保留设置页面所需的完整投影。它没有另存授权状态,也没有新增执行条件。调用方仍须在自身发布阶段核验身份、当前 Turn、撤销与 CAS。
具体改动 / Changes
依据 docs/architecture/rfcs/app-conversation-and-async-inbox-v0.md,规范版本 7edd100bddc07c1e8dd641e495bff39c7050f2ba:Workspace-current-grant 要求当前准确工作区及 grant;Lark-single-authority 保留 Core 唯一会话/撤销权威;Observation-not-delivery 明确实现与实际采用分开。三项在本改动中落实为现有源读取、无新增授权状态和独立安装/业务验收边界;不能把一次成功快照当成入库或送达。
关键代码讲解
PrivateConversationRequestMixin._private_conversations只接受一个明确的view=authorization;空值、重复或未知值返回 400。读取当前绑定和工作区后再读绑定,变更返回 409。响应保留调用方所需的绑定、App、上下文、grant 与可用性,不泄漏 principal 或本地目录,也没有伪造健康统计。test_http_authorization_read_does_not_wait_for_bot_health_or_delivery_history通过实际 HTTP handler 和 Core 绑定运行,让无关健康/Agent 读取直接报错。旧 handler 在同一输入下失败;新 handler 返回安全字段,并核真实撤销、工作区消失、并发版本与 Session 无副作用。其余设置、监听、群配置、stop 和大图片健康路径也独立通过。
对主干的风险 / Risks
最需要避免的是把快照误当写权限,或新投影缓存过期 grant。实现不签发 gate,不增加缓存;数据来自当前 Core,且绑定读取期间的变更被拒绝。最终发布仍由原 source owner 核验。默认 settings 路径未删除,整体健康接口自身的慢扫描仍属剩余问题,本 PR 不声称已经改善其全部延迟。
PASS:7 项聚焦 HTTP 测试;同一新增反证在 base 产生 1 项预期失败、原 setup 控制通过。预合并 compile/direct 及 8 个 extension 风险 smoke 通过。首次语义检查缺少本地 TypeScript 依赖,配置既有依赖后重跑通过;原 _admitted_interaction_next_cli_actions 复杂度告警在精确 base/head 相同,由原 premerge 标为 inherited advisory。更宽测试在 100 项通过后主动中断,未冒称全套通过。按当前政策不查询或等待 CI。
语义与 CI 对齐
这里增加的是本地 HTTP 观察选择,不是共享执行状态。正常正文、项目语义、权限、队列和原回复关系不变。负例不通过关键词或业务正文决定状态;没有新增 Goal、消费者或自动业务重试。源码没有公开私有配置、历史或访问令牌。
我的整体评价 / Verdict
本次为 justified_increment / APPROVE。它移除了授权观察对无关健康历史的依赖,能减少重复等待和用户再次发问;没有要求额外表单或确认。在既有 HTTP 投影 owner 增加明确选择的轻量视图,比延长超时、读取私有状态文件或增加缓存更小,也保留默认设置页行为。 当前 PR 只交付可回滚的读取投影与真实 HTTP 反证,不增加消费者、后台执行器或持久授权。
long_horizon 与 user_experience 在该读取边界改善,但安装、调用方切换、材料真正落库和原渠道回复仍必须分别验证。无渲染内容或布局改动,视觉检查不适用;未验证范围就是这些安装与业务环节。没有发现阻塞本精确源码差异的缺陷,不能据此宣布所有 Bot 故障已解决。
English verdict: APPROVE this bounded read-projection fix at 019e746; original installed business recovery still requires independent verification.
Source adapters validating a current workspace grant used the private-conversation setup snapshot, which also waits for listener probes and historical delivery reconciliation. A slow unrelated Bot could therefore stop an otherwise authorized material publication.
Add
GET /api/chat/lark/private-conversations?view=authorization, a read-only projection of the same current bindings and available workspaces. It omits health, delivery counts and Agent discovery, rejects a binding change during the read, and exposes no principal or workspace path. Callers retain their own current-Turn, identity, publication and CAS fences. The default setup/UI response remains unchanged.Validation: the new real-HTTP regression fails against the base handler and passes at this head; seven focused HTTP/setup/image-health/revocation tests pass. The premerge extension placement, registry, entrypoint, presentation and Lark lifecycle smokes pass. Semantic vocabulary verification passed after installing the existing TypeScript dependency. The unrelated existing maintainability finding in
_admitted_interaction_next_cli_actionsremains an inherited advisory. A broader local test sweep was interrupted after its passing prefix; it is not reported as complete. No paid model call or production write is part of this PR validation.