Repository navigation
fix(chat): read manager evidence scope from coordination root - #6893
huangruiteng merged 2 commits into
Conversation
Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
|
[P1] Keep executor-endpoint authority on the Chat root The new When the machine-configured steward endpoint differs between the two roots, authorization returns This trades the reported policy-root bug for a manager-authorization outage for configured stewards. Please keep the executor endpoint resolution on the Chat root, or separate The focused test and the author-cited tests currently pass; the gap is that both roots resolve the same default endpoint in the new test. Other review areas look appropriately scoped. |
Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
|
Addressed in \�dc9b921f. The review correctly found that Re-ran: focused 1 passed; 124 + 89 + 38 related tests passed; Ruff clean. PR body updated to the new head. |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | model=gpt-6.1-sol | provider=OpenAI | declaration_source=runtime_reported | reasoning_effort=max
结论:APPROVE,评审 head:edc9b921f20a4ea0d29ba89596c527e78ef62523。未发现阻塞性代码问题。完整三文件提案已核验;下面保留独立验证范围与既存验证失败。
动机
受影响的是为外部管理会话配置跨 Goal 证据范围的用户。
当 Chat 存储目录与注册表的协作目录不同,旧读路径可能漏读已授权的 Goal,也可能沿用旧目录里的更宽授权;新路径从实际保存授权的协作目录读取。
当前 head 已验证授权收窄、显式清空、后续新增 Goal 和重新授权均由协作目录决定,并保留 Chat 目录中的执行器设置。
本次范围止于现有管理会话的证据读取边界;授权格式、模型执行和界面交互继续沿用既有契约。
改动思路
复用现有授权读取器和协作目录解析,仅把证据策略根与执行器配置根明确分开,避免为同一授权再建一份状态。
当前提案完整交付这条读取根目录修复;真实飞书投递、模型回答质量和长期净收益仍需各自证据。
原先一个 runtime_root 同时承担两种职责,单纯换成协作目录会使配置在 Chat 目录中的执行器失去匹配。这次使用已有 coordination_runtime_root 读取证据策略,同时显式传入 executor_runtime_root,把两种现存权威交给各自拥有者。连接、会话、执行器与 audience 的精确匹配仍先于证据读取;授权范围交给原有 evidence_goal_scope 派生。
| 决定 | 旧路径 | 当前路径 |
|---|---|---|
| 证据策略读取 | 随 Chat 覆盖目录走 | 与配置、回读一致的协作目录 |
| 执行器身份匹配 | Chat 目录 | 保留 Chat 目录 |
此表根据当前源码说明职责,不替代运行证据。继续复用现有 owner 比另建 resolver、复制授权文件或只添加警告更直接,也未引入额外用户确认轮次。
具体改动
先读问题 #6865 与既有评审,再按接受前的 docs/reference/protocols/manager-evidence-and-continuity-v0.md、修订 764b989dce88ef43ade5aba5af4958ee2cf3a821 判断,未用作者新增测试定义需求。以下 MC 索引对应原文相关章节:MC-1 对应 Global conversation initialization 的当前范围读取与同源授权;MC-2 对应 Steward channel host selection 的执行器来源;MC-3 对应 One service, scoped continuity 的过滤及变更撤销。三项在此 head 均已实现并验证。
关键代码讲解
serve_chat.manager_scope:现有服务构造 controller 后使用回调读取范围,把策略交给 controller 的协作目录,把执行器匹配留在服务的 Chat 目录。Owner/private 分支及外部连接快照生产者保持原路径。authorized_manager_goal_ids:增加可选执行器目录;省略时保留当前同目录调用语义。先核唯一连接、audience、Session、connector 与执行器,再读取原生当前授权;没有第二份授权状态。- 测试新增 190 行启动真实
serve_chat,使用真实持久机器设置和证据策略。连接快照为合成注入,飞书 provider 和模型未运行;此范围写明,避免把服务构造验证说成线上回答验收。
对主干的风险
独立跑完七个相邻测试文件:251 passed,无 skip。同一冻结测试文件在真实基线 764b989dce88ef43ade5aba5af4958ee2cf3a821 暴露旧缺陷、当前 head 通过。另在两个版本中显式设置完全相同的“Chat 旧全局授权 + 协作目录只选 Alpha”状态,核对八种情况:窄范围、错误执行器、错误 Session、错误 audience、新增 Gamma、显式全局授权、清空授权及重新授权。当前八项均符合原生授权语义;基线仍会沿用更宽范围,显式清空也不能正确撤销。没有用脚本退出 0 代替这些逐项断言结果。
本地风险 premerge 的 6 项 direct 通过,10 项 selected 均执行,只有语义 twin 门失败。已在实际基线独立重跑,比较完整 46 个原始路径对、2 个已验证生成排除项和相同 44 个独立维护项,连同预算 43 及检查源码均相同。该失败是 pre_existing_unrelated,没有放宽预算,也没有声称整门通过。Ruff 和 diff 检查通过。按当前策略未查询、轮询或等待 CI。
语义与 CI 对齐
共享授权仍由既有 typed Session/connector 与 manager-context 策略决定;新增参数选择数据来源,不授予跨 Goal 执行权。关闭/错误连接、空授权及后来新增对象的边界已验证;这不是新增 default-off 功能。既有回传 transport 未改,实际飞书回传、模型输出以及安装后的全链路仍保留原资格边界。
我的整体评价
本次问题范围达到 goal_achieved,不是父级 manager 产品或长期收益的完成证明。长程维度为 preserved:当前授权在反复读取、撤销与新对象出现后保持有效边界;用户体验为 improved:已配置意图直接生效,新增强制交互为零。复用现有授权读取器和协作目录解析,仅把证据策略根与执行器配置根明确分开,避免为同一授权再建一份状态。当前提案完整交付这条读取根目录修复;真实飞书投递、模型回答质量和长期净收益仍需各自证据。 两个现有 owner 的职责已足够,继续增加抽象没有当前证据支持。保留同目录调用兼容,未新增持久版本分叉;批准后的阻塞 review、质量回执与 merge readiness 另行原生回读。
English verdict: APPROVE — edc9b921f20a4ea0d29ba89596c527e78ef62523. The three-file change reads the current evidence policy from its coordination owner while retaining the Chat executor authority. 251 tests and matched real-service scope counterfactuals pass. The unchanged 44/43 twin-budget failure remains disclosed; live provider/model behavior and long-term benefit are not claimed.
Goal And Delivered Outcome
--runtime-rootoverride while configure/readback persisted it underChatRuntimeController.coordination_runtime_root(the registry'scommon_runtime_root). With different roots, a valid grant silently collapsed to the connection's own Goal, and a stale broader grant on the override root could be inherited. The same function also resolves the configured manager executor, which belongs to the Chat override root; both authorities must be passed separately.all_registeredgrant resolved to["goal-alpha"]; after, it resolves to["goal-alpha", "goal-beta"]. Before, a stale override-rootall_registeredgrant shadowed a narrower coordination-root selection; after, the narrower["goal-alpha"]selection wins.loopx-project/loopx:main.Author Declaration
AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.
Implemented against
resolve_runtime_rootas the read-path owner. The implementation uses the already-constructedChatRuntimeController.coordination_runtime_root, the same root used by configure/readback.loopx/chat_server.py::serve_chat.manager_scopetests/test_chat_lark_api_contract.py::test_manager_scope_reads_policy_from_coordination_root_when_chat_root_overridesmanager_scope->authorized_manager_goal_ids(... runtime_root=coordination_runtime_root)manager_scopeno longer passes override-resolvedruntime_rootauthorized_manager_goal_ids(... executor_runtime_root=runtime_root)inloopx/extensions/lark/manager_routing.pysteward_executor=dshon the Chat root before resolving scopeChatRuntimeControllerroot derivation; used the existing root owner instead of adding a second resolver or a warning-only workaround. Split policy and executor roots in the existing authorization helper so the Chat storage override cannot disable a configured manager executor. Left persistence formats, policy semantics, and unrelated Chat behavior unchanged.Scope And Continuation
Validation
edc9b921fstaticpasseduv run --extra test ruff check loopx/chat_server.py loopx/extensions/lark/manager_routing.py tests/test_chat_lark_api_contract.py->All checks passed!regression_paritypassedassert ['goal-alpha'] == ['goal-alpha', 'goal-beta']; ignoringexecutor_runtime_rootfails it withassert [] == ['goal-alpha', 'goal-beta']; the final code passes.real_entrypointpassedpytest tests/test_chat_lark_api_contract.py::test_manager_scope_reads_policy_from_coordination_root_when_chat_root_overrides -q->1 passed. The test starts the realserve_chatHTTP server with different registry and override roots, configuressteward_executor=dshon the override root, and resolves the manager scope through the live controller.unitpassedpytest tests/test_chat_lark_api_contract.py tests/test_manager_evidence_scope.py tests/extensions/test_lark_goal_topic_connections.py -q->124 passed.integrationpassedpytest tests/test_chat_manager_context.py tests/test_chat_manager_inspection.py tests/test_chat_transport_composition.py -q->89 passed.integrationpassedpytest tests/test_manager_context_execution.py -q->38 passed.unitblockedCodexChatAgentError: executable_not_found; the same failure reproduces at the clean upstream-base worktree, so these suites are not used as change evidence.manager_scopeclosure throughChatHTTPServer,ChatRuntimeController, the typed audience channel, and policy lookup. The integration rows exercise manager context delivery, inspection, transport composition, and real Chat dispatch around the same root boundary. No UI, persisted schema, provider protocol, or execution backend changed. No model-backed success is claimed.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).