Skip to content

refactor(chat): move the public status owner into Chat - #8011

Merged
loopx-agent merged 2 commits into
mainfrom
codex/m1-chat-status-owner-20261104
Nov 8, 2026
Merged

loopx-agent merged 2 commits into
mainfrom
codex/m1-chat-status-owner-20261104

Conversation

@cocolord

@cocolord cocolord commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Delivered result

Move the complete Chat status owner into loopx.chat.status_api. The Chat HTTP server and Todo detail import that owner directly, and loopx.chat_status_api is removed rather than retained as a compatibility alias.

A repository and published-surface audit found no external importer for the old top-level module. All active callers and tests now use the canonical module; reload/pickle/deprecation compatibility for the removed internal path is intentionally not preserved. This exemption is limited to this internal-only relocation.

Validation

  • 283 affected Python tests passed across canonical import, absence of the legacy module, real HTTP status serving, path redaction, host activity, CORS, delivery review, workbench roots and source-session denial.
  • Exact-head quick premerge passed 4 direct checks, 3 catalog canaries, public-boundary scanning and changed-Python compilation.
  • Source routing, source loss/recovery, profile refusal and authorization behavior remain in the existing owner. No provider, persisted schema, execution authority or frontend route changed.

Remaining gates

This completes one M1 status-owner slice, not the wider public Chat migration, split distributions, R1 managed minimal or installed-host qualification. Cross-platform and PostgreSQL runtime paths were not exercised. No automatic host upgrade is performed.

…lias

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@cocolord

cocolord commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Exact-head CI readback — merge hold

At head c755aa0b421a2639ab9b1df16da553a1a9c4377e, independent review is still absent and remote validation is not green:

  • kernel-contracts fails in the configured python -m mypy check: 789 errors across 126 files reached from 17 configured roots. No error names the moved status owner or either changed production caller. This observation does not establish base/head type-check parity; that comparison remains unqualified.
  • chat-bundle-browser (1) times out in the research-display-language scenario at its existing page.waitForFunction. The scenario and dashboard source have no base/head diff, but this alone does not prove the failure is unrelated or flaky.
  • Other reported checks include successful static checks, Chat bundle, artifact build and browser shards 2/3; some test shards were still running or cancelled at this observation. These are not a complete CI pass.

The original source, installed-wheel, AST/denial and premerge evidence remains scoped to the tested head and fixtures. No CI rerun, timeout increase, type-check relaxation, runtime merge or installation has been performed. Keep merge held until failed validation is explained/resolved and the unchanged head receives independent review and current merge readiness.

loopx-agent
loopx-agent previously approved these changes Nov 4, 2026

@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。

动机 / Motivation

维护 Chat 状态接口的开发者,以及仍从历史模块导入状态处理器的独立调用者。 原先状态实现留在顶层模块,逐步拆分 Chat 时容易留下第二份实现;本次把完整实现迁入 Chat,并让历史路径继续指向同一模块,避免调用者升级后 patch 点失效。 已验证新旧导入具有相同模块身份,真实 HTTP 仍读取原始 Goal 来源;来源损坏时拒绝读取,恢复后无需重启即可继续。 本 PR 只迁移 status 所有权,不宣告完整 Chat 拆分、独立服务分发或现有 Host 升级完成。 完整 Chat 所有权迁移及后续独立分发仍需后续既定迁移步骤,本次只交付可独立验收的 status 边界。

改动思路 / Approach

完整实现只有一个 Chat 所有者;兼容层只保留导入身份和一次弃用提示,未复制决策、配置或状态。 本次边界是 status 实现、两个现有调用者、历史导入契约及其回归保护;其余服务拆分不作为当前验收条件。 源 registry 决定 Todo 的实际 runtime;私有 Chat runtime 和全局发现信息不会成为第二个 Todo 所有者。选择完整移动而不是逐个复制函数,是为了让历史 patch、reload 与 pickle 继续看到同一对象,后续权限修复也只需修改一个位置。源码中的状态读取、delivery review、失败分支和路径清理在解析相对导入后 AST 一致。

具体改动 / Changes

核对基准:79b7818653bc4105ea27a8946de04a9ba997ff03;本次 head:c755aa0b421a2639ab9b1df16da553a1a9c4377e。规范为 docs/architecture/rfcs/monorepo-distribution-split-v0.md,spec_revision 79b7818653bc4105ea27a8946de04a9ba997ff03。I3:历史公开导入保留至少一个 minor release 并提示迁移,已实现;M1:本次 status 所有权子边界已实现,完整 Chat 迁移没有在此宣告;I2:原来源和权限边界维持;M3:分包预发布及干净分包安装阶段超出当前范围。两份 RFC ledger 同时更新,不能将 ledger 本身当作运行证据。

关键代码讲解

  • goal_read_runtime_root, status_api.py:56 保留来源 registry 的 runtime 选择,todo_detail 也从同一位置导入,避免状态页与 Todo 详情各自解释来源。
  • ChatStatusRequestMixin, status_api.py:168 是真实 HTTP 处理器。378 行实现完整迁移,原查询、profile 拒绝、来源失败与 JSON 清理不变;chat_server 同时切换到新 owner。
  • chat_status_api.py:22 将历史名称绑定到同一个模块,不是复制导出。22 行 shim 没有另一套业务函数;旧路径首次导入才发出弃用提示,canonical 导入保持安静。

对主干的风险 / Risks

最强反例是旧路径 patch 成功、HTTP 却从另一份 globals 读取,简单的“名称还在”测试会漏掉它。本次原始实际 HTTP patch 测试通过;人为替换成复制导出后,同一测试从预期 200 变成 404,证明回归 oracle 能识别这种错误。导入顺序、reload、pickle、已加载消费者、profile 拒绝、grant 撤回与路径清理共 260 项通过。

File/SQLite 的 20 组真实 HTTP 语义对照,在基线、新 head 和独立安装 wheel 上一致:正常来源 200,未知 Goal 404,来源缺失/目录不可读/错误 Goal 500,恢复或替换来源无需重启。对照比较状态码、ok、完整错误、键集合、Todo 身份和路径脱敏;原始 payload 保留,不将动态时间和 UUID 宣称为字节级一致。安装后的 loopx 确实来自隔离 site-packages,四个运行文件与该 head 字节匹配。合成 host observer 为 no-op,未替换真实 collector 或 canonical 后端。

原生 premerge 6 项直接检查及 17 项选择检查通过,含双语 RFC、compile、diff 和公共边界;语义 advisory 未检出受支持的新 vocabulary carrier。作者已经提供的 mypy 789 errors/126 files 和 browser timeout 仍记作原因未明的非必需诊断;本轮没有查询、轮询或等待 CI,也没有推断它们既有、无关或 flaky。共享 attention lease 在来源恢复后仍含 decoy 的现象同时存在于基线与 head,未把它列为本次修复或新回归。

我的整体评价 / Verdict

没有发现阻断性问题,APPROVE。 完整实现只有一个 Chat 所有者;兼容层只保留导入身份和一次弃用提示,未复制决策、配置或状态。 本次边界是 status 实现、两个现有调用者、历史导入契约及其回归保护;其余服务拆分不作为当前验收条件。 完整 Chat 所有权迁移及后续独立分发仍需后续既定迁移步骤,本次只交付可独立验收的 status 边界。 长程行为保留同一来源与重读恢复,没有增加双写或手工同步;公开导入兼容有实际调用者和分发验证支持,而不是为假设消费者保留多套实现。

本次只迁移或扩展 CLI/HTTP 所有权;已检查既有能力编辑器、状态读取与结果消费入口,没有渲染页面或布局改动。 没有进行已安装 Host 的界面验收;该范围不属于本次源码和隔离 wheel 验证。 远端诊断、实际安装升级和后续完整迁移仍需各自所有者验收;本结论不等同于 merge readiness 或合并授权。

Reviewer: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max. Host-reported execution identity is provenance, not backend-weight or effectiveness proof.

English verdict: APPROVE. The relocated status implementation preserves the public module identity and source-authority behavior; real HTTP and an isolated wheel installation pass the bounded compatibility checks. Supplied CI diagnostics remain unresolved and separate from merge readiness.

@huangruiteng huangruiteng 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.

Image 这种类似的不用兼容,外部没有人import

@huangruiteng

Copy link
Copy Markdown
Collaborator

之后重构也同理

@mergify

mergify Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @cocolord.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent loopx-agent changed the title refactor(chat): move public status owner with identity-compatible imports refactor(chat): move the public status owner into Chat Nov 8, 2026

@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.

Self-review of exact head 5ba76a54becee76b167fb74f893df9a4d2f71b53: PASS.

The maintainer comment is addressed directly: loopx.chat_status_api is deleted, with no alias, deprecation warning, reload or pickle compatibility shim. Chat HTTP, Todo detail and every affected test now use loopx.chat.status_api; tests explicitly assert that the old top-level module is absent. RFC text records this as a limited compatibility exemption for an internal-only relocation.

Verification passed: 283 affected Python tests covering real HTTP, source routing/recovery, path redaction, host activity, CORS, delivery review, workbench roots and source-session denial; exact-head quick premerge, bilingual checks, Python compilation, maintainability, semantic vocabulary and public-boundary scan.

@huangruiteng huangruiteng 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.

Approval of exact head 5ba76a54becee76b167fb74f893df9a4d2f71b53.

The requested compatibility cleanup is implemented: the internal-only loopx.chat_status_api path is removed, all callers and tests use loopx.chat.status_api, and no compatibility alias remains. The affected status, HTTP, routing, redaction and denial suites plus exact-head premerge passed.

@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 8, 2026
@loopx-agent
loopx-agent merged commit 520a1ab into main Nov 8, 2026
4 of 23 checks passed
@loopx-agent
loopx-agent deleted the codex/m1-chat-status-owner-20261104 branch November 8, 2026 17:15
loopx-agent added a commit that referenced this pull request Nov 8, 2026
The Chat status owner moved under loopx.chat in #8011. Pin the observed one-file reduction and retain the entry-point allowlist and regression guard.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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.

3 participants