Skip to content

refactor(core): keep benchmark execution out of capability discovery - #9034

Merged
huangruiteng merged 1 commit into
mainfrom
codex/minimal-core-closure-20261119
Nov 19, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/minimal-core-closure-20261119

Conversation

@cocolord

Copy link
Copy Markdown
Member

Goal And Delivered Outcome

Capability help/list/detail must work without loading an unrelated benchmark executor, native installer, experiment board or capacity ledger. The previous package facade eagerly imported 199 symbols from 26 owner modules before metadata could be read. Resolve those same public names on first explicit use instead. Discovery retains only the catalog and four-arm metadata dependency; explicit star imports still load all public exports.

Related to #5072, small-kernel RFC V1/V3 and the R1/M3 prerequisite. Target: main. No task strategy, state transition, provider readiness or activation default changes.

Author Declaration

Written by: model_agent — OpenAI Codex. Implemented against the paired monorepo-distribution-split-v0 RFC and its existing demand-loading, compatibility and original-result recovery contracts.

Criterion Disposition Evidence
Metadata discovery loads no optional benchmark execution implementation implemented Fresh source and installed-Core CLI checks with those imports unavailable, no Node and denied process/network effects
Retain public imports and active benchmark behavior implemented All 199 original export names/order and canonical object identities; explicit child and star imports; selected missing implementation remains an error
Keep installed execution, authority and recovery intact implemented Rebuilt Core wheel and existing File/SQLite task/context/stop/recovery suite
Full minimal closure and isolated Standard packages deferred Existing R1/M3/D2/D5 owners remain open

Bounded refactoring applied: one explicit name-to-owner map also supplies __all__; static re-exports preserve typing. Reuse the established package lazy-export pattern; add no runtime module, registry, provider id, policy or toggle.

Scope And Continuation

Reconcile the bilingual RFC with the accepted simplification direction: core execution/recovery before unrelated directory moves; the unproven 10% complexity / 90% functional-coverage target; proposed Standard selection of agent-turn-recall, issue-fix and pull-request-review; Yardstick as an independent optional method. These specify the target and do not claim the package selection already exists or alter current defaults.

This slice narrows the loaded dependency closure. It leaves benchmark files in the wheel and does not qualify full installation/context closure, model effectiveness, complete costs, Standard/workspace packages or release-channel adoption. Continue those existing RFC outcomes; return to the previous facade to roll back without state migration.

Validation

Tested runtime head: 6c481cfee739e9e22237e282735d5440efd1a5f5, based on verified main@e235cde9c. Inputs: synthetic, public_fixture. Local run state: finished; remote CI is separate.

Check Result / boundary
Historical-defect sensitivity Original facade fails the new discovery check by importing adaptive_concurrency; the revised source and installed artifact pass with execution implementations unavailable. Selecting a missing implementation still fails visibly.
Matched real CLI 53 help/list/JSON/Markdown detail/unknown-id observations exactly match immutable main; all 25 capability records match. No task state is created.
Loading census Identical catalog/detail workload: benchmark children 28 → 2; total LoopX modules 326 → 298. This measures imported modules, not speed or model cost.
Public API and consumers 383 selected benchmark/catalog cases pass. All 199 original exports retain order and canonical object identity; wildcard imports remain supported.
Installed Core 52 cases pass on the independent wheel: discovery, guided setup, default SQLite/configured File execution, independent artifact acceptance, lifecycle, SIGKILL recovery, exact-once replay and invalid/stale-lease refusals. All 1,907 packaged runtime files match the tested source bytes.
Source/static 43 architecture/documentation cases and 29 selected CLI cases pass; targeted benchmark types and configured 17-file mypy pass; changed-file Ruff and staged/exact-head bilingual checks pass. Semantic advisory introduces no supported new vocabulary; full semantic canary passes.
Quick premerge Six direct checks and changed-path public-boundary/semantic/permission checks have no blocking execution failure. Overall manual_review_required retains the benchmark hold and one inherited maintainability advisory. The same check independently fails on immutable main and this head for the unchanged oversized _admitted_interaction_next_cli_actions; it is not reported as a passing check or repaired by this proposal.

No model service, benchmark campaign, live Goal modification, user-host upgrade, public release or merge was performed. Ordinary installed-wheel, other-host/platform and complete-cost qualification are not claimed; source ordinary/selected CLI observations and the separate Core installation cover this bounded change.

Frontend / Visual Evidence

UI impact: none. CLI metadata/output and permission/readiness fields are unchanged; the before/after concerns whether that entry loads unavailable unrelated code. No graphical viewport changes or screenshots apply.

Boundary Checklist

  • Public-safe diff and evidence summaries; no private state, local machine paths, credentials, raw traces or internal links.
  • No duplicated benchmark campaign or execution owner.
  • Both RFC mirrors change; staged and exact-head bilingual checks pass.
  • DCO sign-off on every commit.
  • Generated environment lockfile is excluded.

…covery

Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults.

Signed-off-by: cicolord <cicolord@outlook.com>

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)

动机 / Motivation

用普通 CLI 或独立 Core 查看能力的人,要先知道当前可选的工作入口和输入。
以前打开帮助会加载 Benchmark 的实验、执行和容量模块。现在相关实现不可导入时,仍能查看帮助、能力列表与详情。
相同输入下,帮助、列表和详情输出保持一致,只有实际选择的实现才需要被导入。
这次交付的是能力发现切片。独立剔除 Benchmark 执行文件、Standard 装配和完整拆包资格各有后续验收。
继续验收不含可选实现的装配与发布渠道。长期效率和覆盖率仍需按同一批真实用户任务测量。

改动思路 / Approach

现有目录继续提供发现元数据,兼容包入口按调用者请求解析到原有实现。这让读者避开执行依赖,同时保留全部公开导出。
当前交付按需发现和可安装 Core 的回归证据。发行物裁剪仍由现有分包 owner 验收。

调用 capability help、list 或 show 时,目录仍由原有模块生成。以前包初始化连带加载执行、研究数据和容量控制。本头一开始只读取发现需要的元数据。显式访问一个能力符号时才导入它的实现,星号导入仍按调用者要求加载全部。评审先核对接受的最小 Core 旅程,再验证独立 wheel 上的读取和既有恢复。

具体改动 / Changes

以 docs/architecture/rfcs/monorepo-distribution-split-v0.md 为依据,基线 e235cde。V1 的按需发现和 V3 的相关 CLI 兼容已经验证。R1 的完整宿主组合和 M3 的完整拆包发行继续验收。中英 RFC 一并更新,候选 Standard 组合与复杂度、覆盖率假设仍待发布与实测。

关键代码讲解

  • _EXPORTS 保留原 199 个公开导出与顺序。独立对照旧 import、当前静态声明和真实对象,仍由原 26 个模块实现。
  • getattr 在调用者第一次引用时解析,缓存同一个实现对象。显式访问子模块继续有效,缺少所选实现与未知名字仍按原 Python 错误边界处理。
  • test_capability_discovery_survives_unavailable_benchmark_execution 清空 PATH,隔离未选中的执行依赖,运行真实命令。安装 Core 发现测试 从干净安装的 wheel 重走这些入口。

5 个文件主要是移动原导入及增加映射与验证。保留静态重导出让现有类型和调用者继续识别这些名字;以后增加一个名字时要同步映射。

对主干的风险 / Risks

最有可能的回归是目录仍在缺依赖时启动失败,或延迟导出遗漏旧符号。同一缺依赖测试在基线失败五项,候选六项通过。29 个精确对照覆盖帮助、两种列表、25 项详情和未知 id,输出与退出状态逐字节一致。裸包导入由 27 个 Benchmark 子模块降为 0,按需读取目录仍可选择它需要的元数据。全部 199 个对象、顺序和星号导入通过核对。独立构建并安装候选 Core,46 项发行测试和 6 项上下文/恢复测试通过。

语义与 CI 对齐

继续沿用既有目录、optional capability 与原执行 owner。只读发现不触发进程、网络和状态写入。RFC 双语检查、编译、差异检查与 quick canary 的直接检查通过。维护性建议来自同基线的 interaction_contract.py。受管合并还缺当前修订的质量收执,并保留人工复核。按当前配置未采集 GitHub CI。

我的整体评价 / Verdict

没有阻塞性发现。查看已知能力的用户可以在无关依赖缺席时继续读到结果。已有受治理任务的验证、重启与证据读回继续通过同一 Core 安装。独立 wheel 上保留现有任务、状态和目录规则,工程代价集中在单个兼容入口的名称映射。
未运行真实模型或 benchmark campaign,安装器裁剪、完整发行资格、时延与成本仍待独立验证。 分包切片与本 PR 共改发行验证和 RFC。两者整合后应在最终头重跑安装与双语检查。相关 PR #9038

English verdict: APPROVE at 6c481cf. The isolated source and installed Core preserve public exports and discovery while avoiding unselected benchmark dependencies.

@huangruiteng
huangruiteng merged commit cc290b2 into main Nov 19, 2026
38 of 47 checks passed
@huangruiteng
huangruiteng deleted the codex/minimal-core-closure-20261119 branch November 19, 2026 05:59
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