Skip to content

fix(pi): keep status inspection from locking startup authority - #7303

Merged
loopx-agent merged 3 commits into
loopx-project:mainfrom
Jim-jimu:fix/pi-inspect-authority
Oct 25, 2026
Merged

loopx-agent merged 3 commits into
loopx-project:mainfrom
Jim-jimu:fix/pi-inspect-authority

Conversation

@Jim-jimu

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis: reproduced Pi adapter defect; status inspection must not prevent a later explicit startup.
  • Goal/source and gap: inspectLoopx established session authority from a bootstrap preview with no advertised capabilities. A subsequent Pi startup advertising task_lease_v0 was rejected as an authority change, even for the same Goal and Agent.
  • Observable before → after: inspecting with /loopx, status, history or list could prevent startup; inspection now only presents the packet, and explicit startup establishes authority. The regression-parity row below covers this sequence.
  • Issue/task and intended base: Related to Pi host loop can never activate: adapter omits the thread id and the CLI has no pi entry in HOST_THREAD_ID_ENV #5675; base main. This does not claim to resolve the broader first-use Pi acceptance issue.

Author Declaration

Implemented against

  • Specification and revision: the startup-only authority contract in loopx/pi_goal_mode/loopx-goal.ts and locked-session authority contract in loopx/pi_goal_mode/README.md, at af68b0ff180ca8309b5d63d7ee326c77848521bb.
Criterion Disposition Symbol / path Test or command
Only explicit startup creates authority; inspection remains a preview implemented inspectLoopx, startLoopx tests/pi_goal_adapter_authority.test.mjs
Established Goal, Agent, registry, capabilities and token remain locked implemented Existing authority comparison retained Same adapter suite: token preservation and four mismatch cases
Identity selection remains explicit implemented Startup selection gate unchanged Same adapter suite: selection-required packet cannot issue authority
  • Self-check before submission: reviewed the adapter, runtime, Pi documentation, related PRs and complete diff. Added executable adapter regressions and two native CLI sequence cases. Used synthetic fixtures. No model execution or live Pi session was used.

Scope And Continuation

  • Completed scope: remove authority initialization from inspection, remove its unused session-key argument, document the rule and add regression coverage.
  • Slice boundary / successor: implementation complete within this scope. No automatic Agent takeover, capability merging, token replacement or session-recovery redesign. Native guided-start qualification remains blocked locally and needs an environment that permits the runtime.
  • Bounded refactoring review: applied only removal of the now-unused inspection argument; broader runtime changes are unnecessary.

Validation

  • Tested revision: c9351fd9a86b30d6dc5b9ef8ecddc7bc89693b75. Final focused suites ran on this commit. Broader checks ran on the same changes; the API upload preserved the code tree.
  • Run state: finished.
  • Input classes: synthetic, public_fixture.
Check kind Result Public-safe evidence / limitation
regression_parity passed Same 12-case adapter suite: 6 failed / 6 passed on the original adapter; 12 passed after repair. Original failures included the authority-change rejection after inspection.
unit passed 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.
integration passed 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.
real_entrypoint blocked tests/control_plane/test_pi_adapter_start.py: 12 cases failed before guided-start delivery with runtime_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.
static passed npm run -s typecheck:control-plane; python -m mypy; Ruff on the two changed Python test files; git diff --check.
static failed Repository-wide Ruff found 5 existing E701/E702 violations in unchanged tests/presentation/test_codex_attached_conversation.py; reproduced against that file from the base commit.
integration blocked Full pytest with --maxfail=1 stopped during collection on runtime_host_permission_denied; no full-suite pass is claimed.
integration failed npm run -s test:control-plane encountered failures including local listener EPERM and runtime permission denial; stopped without a completed aggregate result.
real_entrypoint blocked python examples/control_plane/cli-output-budget-regression-smoke.py encountered the same runtime permission denial.
integration failed 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.
static blocked Standalone loopx check through 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.
manual not_run Live Pi TUI, full guided-start activation and remote CI have not been qualified.

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.py and examples/cli-project-lifecycle-command-modularization-smoke.py. Their failures are not claimed as fixed or conclusively attributed by this PR.

  • Coverage and gaps: adapter regressions cover direct startup, repeated inspection, previewing a different Goal, preservation of issued authority, rejection of actual authority changes and identity-selection gating. Native CLI and broader-suite qualification remain incomplete; this is not a merge-readiness claim.

Frontend / Visual Evidence

  • UI impact: none; rendering and widget contents are unchanged.
  • Before / After / First viewport and preview / States and viewports shown: N/A.
  • Source data: none.
  • Attention review / Craft review: N/A; no presentation changes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference: Shared Goal Authority and cross-host coordination; bounded Pi startup defect, with no new protocol or roadmap claim.

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

  • Neither the diff nor this body discloses private state, credentials, raw traces or verifier output, internal links, or local machine paths.
  • No maintainer-owned benchmark work was duplicated.
  • The change stays within the reproduced Pi inspection/startup defect.
  • No paired RFC changed; the premerge bilingual check passed.
  • UI impact is marked none.
  • The commit includes a DCO Signed-off-by trailer.

Signed-off-by: Jim-jimu <3230103159@zju.edu.cn>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-25T08:30:52.893441Z
We couldn’t complete this review. Comment @codex review to try again.
c9351fd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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 loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

结论: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.

@loopx-agent
loopx-agent merged commit 69f876f into loopx-project:main Oct 25, 2026
24 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants