Repository navigation
Description
Current delivery decision (2026-11-15)
Split legacy-path retirement and actual dependency closure into three bounded implementation PRs. Retire already-migrated old paths early instead of keeping every shell until the last integration change. Moving implementation, migrating active consumers/docs/tests and deleting old root modules belong in the same PR. Overall isolation is a real-tree result, not an issue-status or merge inference. This issue closes root-level scattering, old entrypoints and core dependency boundaries; it does not promise internal refactors of existing subpackages.
Related: #387, #371, Apps migration #408, shared contracts/resources #451, and Apps-only MindIE relocation #452.
PR checklist
- R1 — Retire existing legacy root paths and finish canonical inspection binding. Delete the seven Knowledge shells (
_skill_selection,_source_snapshot,catalog,knowledge_operations,knowledge_store,research,skill_catalog), the three B01 root paths (evaluation,execution,reporting), and rootinspection. In this same PR update all active consumers, including the CLI/arguments if they have not moved yet, tools/current tests/docs, the manifest and affected protected-path rules. Root inspection is not a trivial alias: first preserve its command/snapshot/repository-identity binding in the canonical Apps composition atapps/inspection.pyover the existing infra facts API. Do not delete behavior or injection assertions. Maintain the shrinking exact root-file inventory introduced in C1. If R1 is scheduled earlier, record its removals so that C1 initializes the guard from the real tree; R1 does not need a second root guard. Whencatalogis retired, consumers takeREPO_TYPESfromresources.repository_packsas the same object (identity assertion), never a copy. Record the exact remaining compatibility pairs at each step: the eight root-shell pairs disappear with the seven shells, and the neutral-leaf importer (infra.inspection -> resources.repository_packsafter C2) must be covered by a permanent rule outsidecompatibility_pairs, with a negative test that only that exact edge is allowed. Leaving it incompatibility_pairskeepsallowlist: 1infirst_wave_report()and makes the finalblockers == ()unreachable. - R2 — Close artifact-primitive dependencies in six Harness modules. Remove the
infra.artifactsreachability fromagent_sessions,candidates,optimization,optimization_session,projectandtask_protocol, using equivalent Harness-owned primitives or explicit suitable ports. Preserve writer/digest/hash/lock bytes, atomicity, failure and platform semantics. The existing report has 12 path hits from these six modules, not 12 modules: each module carries both the package-levelinferrsi.infraedge and theinferrsi.infra.artifactsedge, so removing both is the completion bar; replacing them with imports of otherinferrsi.inframodules does not count. The same PR also verifies that Harness has noinferrsi.modeledge (the current tree has none); the final gate counts bothinferrsi.infraandinferrsi.model. - R3 — Close five real execution boundaries and prove the combined tree. Handle
harness/task_protocol.py, the moe-forward-npu benchmark/grader, qwen21-denoise-npu benchmark and qwen3-tts-npu benchmark through legitimate bounded execution/host interfaces. Preserve candidate/sandbox/integrity controls and frozen input semantics. This PR contains real boundary fixes and final integration acceptance; do not create a ninth verification-only PR.
Dependencies and merge discipline
R1 has no hard prerequisite on C1/C2 (#451) or A1 (#408): deleting existing legacy paths does not itself require relocating a neutral resource leaf first. Prefer C1 → C2 → R1 in the serial queue to avoid rewriting contract/resource policy twice; do not wait for A1/A2/M1 to retire the existing eleven paths. C2 does require the contracts package delivered by C1. Start the shrinking root-file inventory guard in C1, then update its exact set here and in every removal PR. The final two-file target is checked only after the actual remaining moves.
R2 is logically independent and may be scheduled earlier if useful, but only one Claude implementation session runs at once. R2 and R3 both touch task_protocol; R3 must integrate R2's actual head. R3 implementation planning can start earlier, but its final integration/tested head must contain all accepted C/A/M/R predecessor changes. Do not represent a planned DAG as authorization for parallel coding sessions.
Acceptance
- R1 really removes the eleven paths, updates all active consumers in that PR and cleans the corresponding compatibility entries, recording the allowlist count at each step and which PR removes the last pair. Canonical injection behavior remains covered; frozen historical evidence bytes are not edited.
- R2 eliminates the six modules' infra/model reachability with positive/negative and platform-sensitive checks, covering both the package-level
inferrsi.infraandinferrsi.infra.artifactsedges, not a permanent allowance for Harness-to-infra imports, and keeping Harness -> model at zero. - R3 resolves the actual five reviewed execution-loader boundaries. Do not merely remove declarations, relax scanners or change expected output to manufacture isolation.
- On the final exact tree:
first_wave_report().blockers == (),new_core_closure_isolated is True, andisolation_complete is True. Harness has zero edges intoinferrsi.infraorinferrsi.model; the permanent neutral-leaf importer rule from R1 is part of this gate and is not counted as a compatibility pair. Negative controls reject old core paths, hidden dynamic imports and temporary forwarding. - The tracked root-file set is exactly
{__init__.py, __main__.py}; wheel checks separately allow only the declared generated_version.pymetadata. Installed-wheel/resources/host and Windows/Linux checks pass without changing original byte/fact/security contracts. - Record all retired paths and replacements in CHANGELOG. Root physical cleanliness and dependency isolation are both required; neither substitutes for the other.
Delivery discipline
- One implementation Claude session handles only the current PR in an isolated worktree. A second Claude session may only plan the next PR in a separate planning worktree; it must not edit source.
- Move implementation, update all active consumers/docs/tests, and delete the corresponding old root modules in the same PR. Do not introduce permanent compatibility shells or module-registry aliases.
- Preserve CLI command behavior, original evidence bytes, record/format contracts and isolation/security checks. Announce retired Python import/serialization module paths; historical frozen evidence remains pinned to its original commit or wheel, not rewritten.
- Before each implementation or review handoff, refresh main and confirmed dependencies. A completed plan is not implementation or approval. No automatic merge.
Historical context retained
The 2026-11-12 R01 scope already required retirement of seven Knowledge shells, three B01 root forwarders, the legacy manifest/allowlist and affected protected roots; installed-wheel/host checks and real positive/negative closure remained mandatory. Its final dependency list included K01/H02/B01/S01/OBS/A-entry, with no mandatory tag wait. The earlier permanent root CLI-forwarder carve-out and the assumption that every retirement must wait for the final PR are superseded by the owner's revised delivery decision. The neutral resource leaf still requires an explicitly reviewed no-core-import rule at its new canonical location; infra must not become a fourth core. No new product feature, K02 resource re-migration or formal replay/model experiment is included. Earlier issue discussion is retained; this update does not claim any new review or implementation acceptance.
Activity
amy-why-3459 commentedon Nov 12, 2026
谢谢,R01 作为收尾任务,验收设计得很好:"真实树
isolation_complete is True"加上"加回旧叶子或转发即失败"的反例。补充几点:rg/import 扫描证明 src、tools、tests、docs 以及三个宿主插件里都没有旧根路径的引用;外部消费者的情况也请在 PR 里说明。正文说"不额外等待固定 tag 周期",那么 CHANGELOG 里"移除路径 → 替代路径"的对照表就是用户唯一的迁移指引,建议逐条列出。infra.inspection → _repo_pack_data技术叶子消费者,以及根 cli/arguments/__main__精确转发)建议在门禁里各写一个反例测试,证明规则只放行这一条边或这一种形态,不会变成通配。status:proposed)。建议在 rfc: K/H/B 与 Apps 公开接口详细设计(最小交接与模块边界) #387 或本 issue 里维护一张依赖状态表,让 R01 的启动条件一目了然。[-]task: R01 — 退役兼容壳与 allowlist,完成整仓隔离[/-][+]task: R01 — retire legacy root paths and close core dependencies[/+]amy-why-3459 commentedon Nov 15, 2026
看到正文改成了 R1/R2/R3 三个 PR 的拆分。我在当前 main(
1373ef8e)上跑了first_wave_report(),和新写的内容逐项对照如下:allowlist: 9 compatibility pairs、legacy run forwarders: 3(对应 R1 的evaluation/execution/reporting)、harness reaches model/infra ... (12 hits)(对应 R2)、runtime resource loaders: 5(对应 R3)。R1 删除 11 个路径,但 allowlist 只有 9 对。建议在 R1 验收里写明 R1 之后 allowlist 应清空,或者列出剩下的确切几对及其负责 PR。inferrsi.infra和inferrsi.infra.artifacts。这和正文"12 path hits from these six modules"一致。所以 R2 必须连包级的inferrsi.infra边一起消除,改成 import infra 下的其他模块不算完成。另外,汇总字符串只显示第一个模块(agent_sessions -> inferrsi.infra (12 hits)),review 时建议看harness_model_infra的完整列表。catalog会影响REPO_TYPES。arguments.py现在从.catalog导入BACKENDS/KNOWLEDGE_REPOS/KNOWLEDGE_SCOPES/REPO_TYPES,而REPO_TYPES实际定义在_repo_pack_data.py。如果按首选顺序在 C2 之后做 R1,消费者应直接从resources.repository_packs取REPO_TYPES,保持同一个对象(和我在 task: consolidate shared contracts and packaged-resource access #451 提的 identity 检查一致)。如果 R1 提前,也不要在 Knowledge 的 canonical 模块里复制一份元组。infra.inspection → _repo_pack_data这条在 C2 后要迁到新位置。建议在 C2 或 R1 里配一个反例测试,证明它只放行这一条边。Dong1017 commentedon Nov 15, 2026
Posted by an agent on behalf of @Dong1017 (incremental review only; points already raised by Amy are not repeated).
Ran
first_wave_report()on current maind32eb968; the four blockers match Amy's numbers exactly. Two additions to her 6892341854 point 1:Exact mapping of the 9
compatibility_pairs. Eight are removed by R1 because they are edges from the seven root shells being deleted:_skill_selection -> knowledge._skill_selection,_source_snapshot -> knowledge._source_snapshot,catalog -> knowledge.catalog,catalog -> _repo_pack_data,knowledge_operations -> knowledge.knowledge_operations,knowledge_store -> knowledge.knowledge_store,research -> knowledge.research,skill_catalog -> knowledge.skill_catalog. The ninth,infra.inspection -> _repo_pack_data, is not a root-file edge:src/inferrsi/infra/inspection.py:10imports the neutral leaf and:56calls it. Even if C2 rewrites that pair to the newresources.repository_packslocation first, R1 would leaveallowlist: 1 compatibility pair, not zero. (The three legacy run forwarders are a separate blocker and are cleared by R1; they are not among the nine pairs.)That last pair cannot stay in
compatibility_pairsif R3's acceptance isblockers == ():tests/_gate_policy_support.py:553-554counts every manifest pair asallowlist: N, and removing the pair while the import remains producesviolations: 1—inferrsi.infra.inspection is a second importer of inferrsi._repo_pack_data(tests/_gate_policy_support.py:489-494; reproduced by callingfirst_wave_report()with only that pair removed). So reaching the final zero also needs a permanent neutral-leaf importer rule outside the compatibility allowlist (with the negative test Amy asked for), or an equivalent gate change; the acceptance text should name that mechanism, otherwise R1 leaves one blocker that no code deletion in the checklist can remove.refactor(R1): retire eleven roots and bind Apps inspection (#459)
zengchuang-hw commentedon Nov 17, 2026
独立源码检视(普通 Issue,不是 PR 批准):基于 main
61303fa8150472dfbda62ec8d77908bc05c73f3b。结论:根路径退役已有实际实现,但不能据此认定“core dependencies 已闭合”或关闭本 Issue。已核实的实现
src/inferrsi/源码根文件仅__init__.py、__main__.py;后者与 console script 均走inferrsi.apps.cli。R1 的 11 个旧根模块已删除,canonical 实现在 Knowledge / Apps;不是仅改目录说明。tests/test_package_root_inventory.py对额外根文件和已退役名称回归有反例;tests/test_knowledge_compatibility_shells.py检查旧 import / pickle 路径失败及不留sys.modulesalias。CHANGELOG.md:114–146明确旧 Python import / pickle 兼容性中断和历史 evidence 不重写。这是实现与迁移说明的证据,不等于完整接口验收。仍然存在的闭合缺口
infra.artifacts。在该 SHA 实跑first_wave_report()得到 12 条可达路径,涉及 agent_sessions、candidates、optimization、optimization_session、project、task_protocol。这里的 12 是图路径命中数,不是 12 个不同的直接 import。violations=(),但new_core_closure_isolated=False、isolation_complete=False。因此“scan 无 violations”不能替代闭合验收。后续闭合证据应绑定实际交付 SHA,证明上述依赖/执行边界按确认过的契约被处理,同时保留 artifact bytes、原子写/锁、候选 sandbox 与完整性负例;不能通过删除扫描项、放宽声明或增加永久 alias 让 gate 变绿。这不是把动态 task 执行本身定性为漏洞,也不是要求直接删除它。
本次验证范围
在独立源码目录用 Linux / Python 运行 root inventory、target-module import gate、legacy-run forwarder gate、knowledge compatibility shells、evidence paths、repository-packs facade 六个测试文件:128 collected,127 通过,1 跳过(archive 无 Git metadata 的 tracked inventory 项);另实跑上述 isolation report。未运行全套测试、installed-wheel/resource 验证、真实 native-host 或 Windows 验证,未验证完整 CLI bytes / frozen-evidence 跨版本等价,不能替这些项目盖章。
本次没有读取或引用其他人的评论/Review 结论,也没有将 Issue 状态或合并状态当作通过依据。需求版本方面,仅按可隔离的“退役旧入口并真实闭合依赖、保留接口/证据/安全边界”范围检视;没有确认混有决策转述的修订段落所述分拆、顺序例外或最终验收谓词,故本意见不表示接受整套架构、不承诺实施,也不是对本 Issue 全部验收条件的 PASS。
Merge main (M1, #477) into the R2 branch
test(harness): drop the in-lock read that Windows denies; pin the R2 …
Dong1017 commentedon Nov 17, 2026
Posted by an agent on behalf of @Dong1017. This is a proposed R3 design for discussion before implementation; nothing below is implemented, and it does not claim review acceptance.
R3 design: close the five execution-loader boundaries
Read against the R2 head
1d0190e01ea59954a679054e697a22450edce011(#478, not merged yet). The implementation will branch frommainafter R2 merges, so its tested head contains R2.Problem
first_wave_report()keeps one blocker after R2:runtime resource loaders: 5. Each is animportlib.util.module_from_speccall that the gate admits through the temporaryRESOURCE_LOADERStable intests/_gate_policy_support.py:harness/task_protocol.pyprotocol()optimization.py(validate_arguments,arguments,assess), into the Harness processmoe-forward-npu/benchmark.py, module scopeprocesses.py(MARKER,cleanup)moe-forward-npu/grader.pyload()task/baseline.pyandcandidate/implementation.pyfrom the run directory, inside each torchrun rankcomputein-process to time itqwen21-denoise-npu/benchmark.pyload()workload,reference,baselineandcandidatefromoutput/snapshot/computein-process to time itqwen3-tts-npu/benchmark.py, module scopeevaluation.pypython -I#412 requires legitimate bounded execution/host interfaces that keep candidate, sandbox and integrity controls and frozen-input semantics, and a final tree with
blockers == (),new_core_closure_isolated is Trueandisolation_complete is True. Removing declarations, relaxing scanners or editing expected output alone does not count.Decision
The sites fall into three kinds. Each kind gets one treatment.
Kind A, site 1: Harness runs the task protocol as a child process
Harness stops executing task code in its own process.
task_protocolruns the frozen protocol file as a program, the same way Harness already runsbenchmark.py:sys.executable -I -B <task root>/optimization.py. The interpreter is the one that runs the protocol today.-IkeepsPYTHONPATH, user site and the current directory out;-Btogether with script execution means the frozen source is compiled every time and no bytecode cache is written or read, which is the existing "always read the frozen source" rule.{"operation": ..., "arguments": {...}}, forvalidate_arguments,argumentsandassess. Paths travel as strings and the protocol turns them back intoPath.{"result": ...}or{"error": {"type": <exception class name>, "message": str(error)}}. stderr passes through to the caller.TaskProtocolError(aValueError) that carries the child's exception type, so the recorded reason stays"<Type>: <message>"(pinned today bytest_assessor_exception_preserves_type_and_settles_failed_attempt). An argparse usage error in the child keeps exit status 2 forsession start. A non-zero exit or malformed response without an error object fails fast.if __name__ == "__main__":dispatch).qwen21-denoise-npu/optimization.pyand the test fixture protocols gain that dispatch; their functions do not change.harness/task_protocol.pychanges, so the runtime identity refuses to resume sessions started before this change, as for any edit to it.Result: Harness has no dynamic import and no in-process path to task code. The CLI and Harness process never execute bundle code; bundle programs run only in child processes.
Kind B, sites 2 and 5: remove the sibling load
These load a trusted sibling of the same bundle only because the directory is not a package. The bundle already uses plain sibling imports elsewhere (
oracle.py, the grader, the TTSbaseline.py), but those rely on the script directory being onsys.path, which fails underpython -Iand for in-process test loading. Merging removes the need for any import path:moe-forward-npu: move the 80 lines ofprocesses.pyunchanged intobenchmark.pyand drop it fromTASK_FILES. Tests that usedmoe._processesusemoe.qwen3-tts-npu: renameevaluation.pytobenchmark.pyand move the 98-line CLI into it; the prepared bundle losesevaluation.py. Tests that loadedevaluationloadbenchmark.docs/tts-benchmark.mdanddocs/engineering-benchmarks.mdfollow.policy.jsonpinsgrader_sha256to the grader file andruntime_sha256to every bundle file, so a bundle prepared before R3 is refused byload_preparedafterwards, as after any grader edit today; it must be prepared again. Retained results are not rewritten.moe-forward-npu: each run directory pins its ownTASK_FILESinidentity.jsonand is adjudicated in the same run, so no earlier run directory is reopened.No loader,
sys.pathchange orsys.moduleschange replaces them.Kind C, sites 3 and 4: keep the two evaluator loaders under a permanent rule
An evaluator must call the candidate's
computein the same process to time it, so some code must load the candidate file there. A static import cannot do this correctly: it caches by module name insys.modules(a second load returns the first candidate), registers the trustedworkload/reference/baselinemodules where the candidate can import and patch them, and needs asys.pathchange. Moving the call torunpyorexeconly hides it from the scanner. So these two loaders stay, with the contract made explicit and tested:benchmark/tasks/<bundle>/, a directory without__init__.py), which run only as child processes.identity.jsonbefore execution and re-verified afterwards (the grader by_adjudicate, qwen21 bymain()and the protocol'sassess).sys.modules; the candidate module must define a callablecompute.The gate moves them from the temporary
RESOURCE_LOADERStable, which counts as a blocker, to a permanentEVALUATOR_LOADERSrule with exactly these two entries, the same (function, spec variable) shape check, and no blocker. This follows the R1 precedent for the neutral-leaf importer: an irreducible edge covered by a narrow permanent rule outside the blocker list, with negative tests.Gate after R3
RESOURCE_LOADERSand theruntime resource loadersblocker are removed. Amodule_from_specinharness/task_protocol.pyor anywhere outside the two evaluator entries is an undeclared dynamic import and a violation.EVALUATOR_LOADERSadmits one call inmoe-forward-npu.grader.loadand one inqwen21-denoise-npu.benchmark.load. The gate also fails if a declared module is not a bundle program file.new_core_closure_isolatedno longer depends on loaders.violations == (),harness_model_infra == (),blockers == (),new_core_closure_isolated is True,isolation_complete is True.Negative controls (new or rewritten): a returning loader in
harness/task_protocol.py; a second call or a call in another function of an evaluator; the same shape in another bundle file (workload.py), in a non-bundle Benchmark module, in Apps and in Harness; a declared module given an__init__.py;import_moduleand__import__next to a declared loader. The existing negative controls for old root paths, forwarders and Harness → Infra/Model edges stay.Semantics to preserve and how they are checked
"<Type>: <message>"and argparse exit 2TypeErrorand a usage error<session>/frozen__pycache__is neither read nor written;-Iexcludes a plantedPYTHONPATHmoduletest_moe_benchmark.pyagainst the merged filepython -I-I --helptest unchangedsys.modulesunchanged, two loads give two modulesPlatforms: H200 Linux full suite on candidate and unchanged
mainwith a failed-id diff; native Windows for the protocol subprocess (test_optimization_session.py,test_project_optimization.py,test_qwen_optimization_protocol.py); GitHubfull-check,installed-packageandhost-compatibility. No NPU run: the NPU paths are unchanged except the loaders' surroundings, and the qwen21 CPU--check-onlypath exercises its loader.Not claimed
runpyandexecremain outside the gate's scan scope, as documented; R3 does not move any loader to them.Point for discussion
Kind C is the only place where the gate admits code permanently. It is chosen as the final form, not a temporary step, so it does not need a later rework PR. The alternative is to keep the two evaluator loaders as blockers. That makes
blockers == ()unreachable unless the evaluators are deleted, so #412's final acceptance would have to be reworded.R3 implements Kind C as described unless a reviewer shows a bounded interface that removes in-process candidate loading without the static-import problems above. Such a counterexample reopens this point before the R3 PR is opened. Comments on kinds A and B, the gate rule or the negative controls are equally welcome before implementation starts.
zengchuang-hw commentedon Nov 17, 2026
Independent design-only increment for the proposed R3 boundary in comment 6948276105. This is not implementation acceptance, authorization to implement, or agreement to relax Issue #412's acceptance gates.
Baseline: current main
a02ef1863e29de4510272e65ae69341b1ef83f22. Previous own inspection: #412 (comment) (main61303fa8150472dfbda62ec8d77908bc05c73f3b). I used the isolated proposal scope and inspected executable code without other reviewers' opinions or author result narratives. The referenced PR478 head was not treated as integrated or as this baseline.Current implementation versus proposal.
harness/task_protocol.py:protocolstill creates a module and executesoptimization.pyinside the caller process;prepareinvokes itsvalidate_arguments, andoptimization_session.py:36,54invokesargumentsandassess. The current gate still declares five RESOURCE_LOADERS. My direct gate run returned zero violations but five runtime-resource-loader blockers plus 12 Harness→Infra hits; both closure/isolation flags are false. Moving execution to a child is therefore a substantive boundary change, not an already demonstrated property.Design conditions to resolve before implementation acceptance:
-I -Baddresses interpreter import/cache behavior; it is not a filesystem/network/security sandbox and does not itself pin file bytes. Freeze and verify the exact protocol/bundle identity before execution, reject incompatible resume identities, and test mutation/replacement cases. Post-execution verification detects drift but cannot undo side effects or guarantee unchanged bytes were executed.grader.loadchecks callablecompute; current Qwen21benchmark.loadreturns its module without that check. Neither loader signature itself accepts an expected digest. Callable/identity guarantees therefore need verification across each actual loading caller; do not infer them from the exception's name or module freshness alone. Keep imported-module registration, wrong-path, extra__init__.py, adjacent imports and repeated-load freshness as separate negative controls.Checks actually run:
tests/test_target_module_import_gate.pyandtests/test_bundle_manifest.py: 32 passed, 43 subtests passed, one pytest-plugin deprecation warning. A separate current-tree gate invocation produced the values above. AGENTS/review guidance is unchanged and was checked. These CPU/static checks validate the existing policy behavior, not the unimplemented R3 protocol or the proposed final gate state.Not run: candidate-versus-main full suites/failure-ID comparison, native Windows protocol checks, installed-wheel qualification, Qwen21 check-only execution, or any model/device experiment. No R3 candidate was supplied/executed here. The original Issue acceptance criteria have not been independently re-authenticated in this increment; the new proposal does not establish their replacement or permission to weaken them. No files were changed and no campaign was resumed.
ci(host): run the R2 Harness primitive and writer nodes on hosted Win…
refactor(harness): close the artifact-primitive edges from six Harnes…