Repository navigation
fix(pi): keep status inspection from locking startup authority - #7303
Conversation
Signed-off-by: Jim-jimu <3230103159@zju.edu.cn>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Signed-off-by: Jim-jimu <3230103159@zju.edu.cn>
Signed-off-by: Jim-jimu <3230103159@zju.edu.cn>
loopx-agent
left a comment
There was a problem hiding this comment.
结论:APPROVE。本次窄修复未发现阻塞性问题;真实原生入口和新版安装包均验证了先查看状态、再合法启动。原始测试夹具仍有可独立复现的失败,单独保留,不称为全绿。
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
审查 head:ac65634987c8725827ce5a5f6cb833f42f26f839;当前完整 PR 基线:61b83ac745a49f9eafadd7b87b085d567a9dca11。旧 head c9351fd9a86b30d6dc5b9ef8ecddc7bc89693b75 在验证期间被上游合并提交替代。当前相对新 main 仍仅五个文件;逐字节核对 Pi 代码、runtime、测试和依赖声明未变,并在新版完整运行环境重做原生入口、构建安装及必需检查,没有继承旧批准。未查询、轮询或等待 GitHub CI。
动机
在 Pi 中继续一个已有 Goal 的用户,常会先查看状态,再明确启动该任务。
旧版先执行 status 会把没有任务租约能力的预览锁成会话权限;随后合法启动携带该能力时反而被拒绝,新版把权限建立留给显式启动。
已在真实 CLI、File/SQLite 状态库和新版隔离安装包中验证:查看状态后可以启动,未授权身份与猜测 token 仍被拒绝。
本 PR 只修复预览干扰启动的缺陷,不解决 #5675 的全部首次使用问题,也不增加自动接管 Agent 或合并能力的行为。
这里的任务不是让用户重新输入已经明确的 Goal/Agent,也不是把只存在一个候选 Agent 当成接管许可。用户已有合法会话绑定时,查看信息不应增加一次重启或重新授权;尚缺身份选择时,既有 native gate 仍需用户补充该真实意图。两个方向都需要成立。
改动思路
把权限建立留在既有 startLoopx/establishSessionAuthority 所有者,直接删除预览的副作用即可修复缺陷;无需新增权限模式、恢复表或策略开关。
批准当前五文件的窄修复;原始 canonical 夹具失败单独保留为测试维护缺口,不扩展到自动身份绑定或完整 Pi 首次使用验收。
最强的反对理由是:只用假的 CLI 返回包测试,可能让本地 SDK 测试通过,却没有证明真实身份路由或安装包可用;本次原始 native 测试确实失败,不能略过。为分辨产品回归和夹具问题,我在两个不可变版本运行相同夹具,再用真正初始化的 canonical File/SQLite 状态库经过实际命令和 installer 验证。没有放宽产品比较,也没有让 mock 提供启动成功这个被验证的后置条件。
| 操作顺序 | 基线 | 当前 head |
|---|---|---|
| 已明确绑定,直接启动 | 可启动 | 可启动 |
| 已明确绑定,status 后启动 | 预览锁空能力,权限变化错误 | 启动发出一个合法可见包 |
| 没有绑定,只有一个候选 Agent | 仍需明确选择 | 仍需明确选择 |
| 已绑定后改变 Goal/Agent/registry/能力 | 拒绝 | 仍拒绝 |
表格结合真实原生场景与明确标注的适配器边界测试;不是 live Pi/model 运行证据。
具体改动
inspectLoopx 删除调用 establishSessionAuthority 的嵌套 try/catch,只解析和显示 bootstrap 预览;参数中不再传递未使用的 session key。空命令、status、history 和 list 全部走这个只读路径。startLoopx 仍调用真实 start-goal,从 native 允许的身份包建立 host authority,再向用户发出启动消息。
establishSessionAuthority 的 Goal、Agent、registry、capabilities 比较以及 token 保留逻辑没有放宽;loopx_goal_activate 对未发出或猜测 token 的拒绝也保留。候选 Agent 列表、安装扩展和显示状态都不是授权。已有 runtime 的租约、CAS、generation、abort、pause/resume 和 dispose 继续由原来的所有者处理,不增加第二套恢复状态。
接受依据:loopx/pi_goal_mode/README.md,固定 revision 61b83ac745a49f9eafadd7b87b085d567a9dca11。首次在旧基线阅读的完整合同与此版本字节相同,未用本 PR 新增四行自证要求。逐项判断:Surface 的预览/显式启动分离,State 的 token 与身份范围锁定,Explicit task leases 的原生租约能力,Boundary 的不自动接管,以及 Pause and resume boundaries 的后续执行控制,均在本次边界有调用或执行证据。#5675 当前讨论明确区分这项预览缺陷和更广的首次使用身份绑定问题;本批准不关闭后者。
语义与 CI:没有新协议名、枚举、CLI 参数、持久状态或开关。README 现在准确说明 inspection 不创建/改变权限,只有显式启动签发 token 并锁定范围;这是已验证的默认缺陷修正。身份和 token 是机器强制边界,预览是信息显示,二者不混称为建议。Pi 专属措辞位于自己的 adapter 文档,不进入通用 quota/Todo 义务。
对主干的风险
当前新 main 基线和 head 在同一真实 Pi-host 环境运行 24 个 canonical 场景:File/SQLite、已选择/未选择 Goal、bound/status-first/sole/multiple/none/ephemeral。基线 20 通过、4 个 status-first 场景出现相同权限变化错误;head 24 通过。特意去除继承的 Codex thread 环境,否则预览会被另一条 host gate 挡住,可能掩盖真正的 Pi 缺陷。真实 native CLI、身份和权限路由、状态库都没有被 mock。
为验证交付路径,又为 ac65634987c8725827ce5a5f6cb833f42f26f839 重新构建 Chat、wheel/sdist,隔离安装新版 wheel,用 python -I 调用实际 slash-command installer,把扩展复制到 disposable 项目的 .pi/extensions 并导入该文件。扩展和 runtime 字节与安装包一致,24 个场景全部通过;状态/registry 原字节、无自动注册/绑定/quota 探测、猜测 token 拒绝均有断言。仅 Pi 的显示/schema SDK 被替代;没有运行真实 TUI 或模型。一次运行因评审脚本漏传 setup-helper locator,在进入产品前全部失败;补齐同版夹具定位后重跑通过,未改产品或断言。
当前标准 premerge 5 项直接检查及 18 项选择检查全部通过,类型检查通过,工作流范围 Ruff 在新基线和 head 均为 0。旧 af68/c935 的 5 条未改文件 Ruff 错误已由合入的 main 修复,不能归功于本 adapter PR。focused 源套件结果仍为 4 failed / 95 passed;其中 52 个 runtime 和 12 个 adapter Node 检查嵌在 Python 测试内,数量不可再相加。
四项红色源测试都在启动前抛 CanonicalAuthorityRequired:原夹具只写旧 Markdown/registry,没有初始化 canonical authority。将同一当前 12-case 夹具仅替换 REPO 定位,当前不可变基线和 head 都是相同四个失败、八个通过,错误详情一致。补全真实 canonical 初始化的独立验证覆盖了被挡住的不变量,并保留基线应失败、head 应通过的对照。此归因不把原始测试改称成功,也没有把作者先前的环境权限错误改写为已修复;原夹具维护和相关 merge gate 仍需处理。
我的整体评价
没有阻塞性产品 finding。现有所有者中的一处删除完成了可复现、影响普通任务启动的修复,省掉多余会话恢复,同时保留真正缺失的身份意图和 token 权限边界。规模与问题匹配,删除未用参数是合适的同域整理;更大运行时抽象或自动绑定都没有必要。
已检查 inspectLoopx 的 widget/transcript 输出和全部渲染调用;本次只改变权限副作用,没有改布局或显示内容,视觉截图不适用。
未验证范围:Live Pi TUI and model continuation were not run; rendering code and content are unchanged. 更广 #5675 首次使用验收、长期模型采用及 remote CI 均未声称完成。APPROVE 是当前精确 head 的代码评审结论;原始 canonical 夹具红项、后续 readiness 和维护者合并授权是独立边界,本次没有合并、全局安装或修改活动 Goal。
English verdict: APPROVE for ac65634987c8725827ce5a5f6cb833f42f26f839. Removing authority establishment from inspection fixes the real status-then-startup failure while preserving explicit identity selection, token checks and immutable session scope. Current-head native File/SQLite and freshly installed-wheel matrices each pass all 24 cases. Four original native tests still fail from the same pre-existing canonical-fixture initialization gap on the immutable current base; retain that separate test/merge limitation. Live Pi/model and the broader first-use issue are not qualified.
Goal And Delivered Outcome
inspectLoopxestablished session authority from a bootstrap preview with no advertised capabilities. A subsequent Pi startup advertisingtask_lease_v0was rejected as an authority change, even for the same Goal and Agent./loopx,status,historyorlistcould prevent startup; inspection now only presents the packet, and explicit startup establishes authority. The regression-parity row below covers this sequence.pientry in HOST_THREAD_ID_ENV #5675; basemain. This does not claim to resolve the broader first-use Pi acceptance issue.Author Declaration
Implemented against
loopx/pi_goal_mode/loopx-goal.tsand locked-session authority contract inloopx/pi_goal_mode/README.md, ataf68b0ff180ca8309b5d63d7ee326c77848521bb.inspectLoopx,startLoopxtests/pi_goal_adapter_authority.test.mjsScope And Continuation
Validation
c9351fd9a86b30d6dc5b9ef8ecddc7bc89693b75. Final focused suites ran on this commit. Broader checks ran on the same changes; the API upload preserved the code tree.node --test tests/pi_goal_adapter_authority.test.mjs tests/pi_goal_loop_runtime.test.mjs: 64 passed. Pi SDK and CLI transport are substituted in adapter tests; runtime logic is real.python -m pytest -q -o addopts= tests/test_pi_goal_mode.py tests/test_slash_command_install.py: 87 passed, including the Node suites above; counts overlap.tests/control_plane/test_pi_adapter_start.py: 12 cases failed before guided-start delivery withruntime_host_permission_denied. The original 10 cases had the same blocker before this change. The two added cases cover status followed by bound-session startup.npm run -s typecheck:control-plane;python -m mypy; Ruff on the two changed Python test files;git diff --check.tests/presentation/test_codex_attached_conversation.py; reproduced against that file from the base commit.--maxfail=1stopped during collection onruntime_host_permission_denied; no full-suite pass is claimed.npm run -s test:control-planeencountered failures including local listenerEPERMand runtime permission denial; stopped without a completed aggregate result.python examples/control_plane/cli-output-budget-regression-smoke.pyencountered the same runtime permission denial.loopx canary premerge --from-git-diff --git-diff-base upstream/main: direct checks, Python compilation and public-boundary subcheck passed; four selected smokes failed, listed below.loopx checkthrough the source Python CLI was blocked by runtime permission denial. The canary's changed-path public-boundary subcheck passed; the diff was also manually inspected.The four failed premerge smokes were
examples/semantic-vocabulary-drift-smoke.py,examples/issue-fix-pr-lifecycle-smoke.py,examples/control_plane/todo-readmodel-boundary-smoke.pyandexamples/cli-project-lifecycle-command-modularization-smoke.py. Their failures are not claimed as fixed or conclusively attributed by this PR.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A. This does not claim TypeScript migration or shared Goal Authority RFC progress, and does not change providers or runtime routing.
Boundary Checklist