Skip to content

feat: share RSI optimization management across project and benchmark tasks - #338

Draft
Bounty-hunter wants to merge 1 commit into
InferMatrixLab:mainfrom
Bounty-hunter:codex/issue252-engineering-benchmarks
Draft

Bounty-hunter wants to merge 1 commit into
InferMatrixLab:mainfrom
Bounty-hunter:codex/issue252-engineering-benchmarks

Conversation

@Bounty-hunter

@Bounty-hunter Bounty-hunter commented Nov 3, 2026 •

Copy link
Copy Markdown

本 PR 做什么

新增一套由当前 Agent 逐轮驱动的优化过程管理,让普通项目任务和内置题库任务共用候选保存、预算、反馈、选优和最终复测;复用原有 Harness 执行器、知识留存与 Dashboard。

  • 普通项目默认在当前 Agent 会话完成;Agent 先准备真实项目的任务说明、输入、质量/性能脚本、指标和门槛。
  • 题库预先提供任务与评测规则,默认使用当前宿主中同一种 Agent 的全新会话执行,发起 Agent 先解析并派发任务;新会话自行 start、迭代和独立 final,父会话回收结果。
  • 执行完声明的轮次及 final 后,提供选中代码的快照路径、独立复测结果、优化记录和可获取的消耗;Dashboard 根据这些记录生成曲线。

当前提交:3cbb74f5f87ba4bbfe54a972a9e9e9b86e5b0ab3。PR 保持 Draft、一个 commit。采用 #362 已接受的模块职责方向;本次没有新增 Apps 包,也没有完成整个仓库的架构迁移。

“共用”仅指本 PR 接入的普通项目和题库两条新入口。原有 run → runner.run_experiment() 没有改为调用 evaluate_round();旧手动 campaign、SkillEval 等路径也没有自动迁入新控制器。 这次是新增上层管理并复用已有设施,不能把新流程的测试当作整个旧 Harness 已完成统一或回归覆盖。

各模块的功能与边界

模块/角色 具体做什么 产生什么 边界
Agent 理解需求,先读 RSI 入口;准备任务条件,分析反馈,按需 profiling/检索,修改候选并调用命令 任务说明、脚本/配置、候选代码、每轮假设、停止原因 Python 不会代替 Agent 自动分析、改代码或发起下一轮
Knowledge 按查询检索、选择和提供资料 内容、版本、来源、遗漏信息 不启动优化;返回资料不证明 Agent 实际使用了资料
Benchmark 提供题包或接收项目明确给出的评测方案;准备规则/命令;根据留存结果做判定 固定任务文件与配置、执行步骤、指标、判定及原因 不从自然语言推导充分的质量标准;assess() 只读结果,不再运行模型
Harness 管理一次运行的预算、轮次、候选、知识留存、执行事实、选优、恢复和 final 候选快照、执行记录、状态、每轮 observation 与 summary 需 Agent/调用方主动调用;受管操作之外的任意 shell 行为不会自动被记录
CLI 与适配函数 修改已有 arguments.py、cli.py;新增 benchmark_operations.py,连接模块并注入回调 命令参数转换、执行/判定回调、命令返回值 session_command()、_session_execute()、_session_assess() 均为本 PR 新增,并非原有函数
原有执行与存储设施 启动进程、控制超时、收集日志/退出状态、写文件与计算哈希 stdout.log、stderr.log、执行记录、文件身份 脚本含义和验收规则由项目/题包提供;设备预约通过指定的命令前缀等机制完成
宿主会话能力 按发起 Agent 的调用创建、观察或取消会话 原生会话 ID、回执、可获取的输出和用量 Harness 仅保存交接记录;本次不接 DSH/自动 Agent CLI 驱动

“固定条件”是保存明确给出的脚本、输入和参数,并在后续操作中检测变化。它不表示操作系统只读锁、可信执行沙箱,或已经隔离所有外部模型、数据和环境。

例如“优化 vLLM 吞吐,输出质量不能下降”,仍需 Agent/用户明确模型、精度、请求集、并发、输入输出长度、计时口径和质量标准,并落实到脚本。普通项目适配器依据这些脚本的实际结果判定,不自动证明质量检查充分。服务吞吐要求也不能用单算子或一个 forward 的加速代替。

实际接入点:哪些新增,哪些复用

flowchart TD
    O["原有命令:inferrsi run"] -->|"解析原有 RunSpec"| R["原有 runner.run_experiment"]
    N["新增命令:campaign round/final<br/>benchmarks session round/final"] -->|"解析任务、候选和假设"| C["新增 session_command"]
    C -->|"注入 execute / assess 回调"| H["新增 Harness evaluate_round"]
    H -->|"提交命令、工作目录和期限"| A["新增执行适配函数"]
    R -->|"原有基线/候选命令"| X["复用 execute_trial / execute_command"]
    A -->|"项目检查命令 / 题包评测命令"| X
    X -->|"保存并返回"| F["退出状态、耗时、stdout/stderr<br/>脚本输出文件路径"]
Loading
接入点 本次变化 未发生的变化
CLI 新增命令分支,调用 session_command() 旧 run 不自动转入新控制器
执行 复用 harness.scenarios.external.execute_trial() 和 Infra 执行器;前者补充环境参数透传 新控制器没有复用或替换整个 runner.run_experiment()
知识 复用 knowledge_capture.capture_context(),外层增加预算/知识开关检查 不保证 Agent 没有读取其他来源
展示 原有 Dashboard 增加读取新状态的分支,展示轮次、曲线与 final 打开 Dashboard 不会启动优化
记录 新控制器维护自己的状态;旧手动 record/decide 禁止写入这种 campaign 没有把所有旧记录和优化入口统一迁移
Agent 使用方式 更新仓库入口说明及两个插件说明,引导调用新命令 说明文档不能强制所有 Agent 行为走这条链路

改动前:原有一次实验及手动关联

以下只比较本 PR 面向的项目/工程任务路径,不声称仓库原来没有任何评测或优化能力。箭头说明每步操作,返回箭头或紧随其后的动作说明产物。

sequenceDiagram
    actor U as 用户
    participant A as 当前 Agent
    participant K as Knowledge
    participant H as 原有 Harness
    U->>A: 提出目标和约束
    A->>A: 读取入口并准备基线、候选、负载、质量命令和 RunSpec 参数
    loop 调用方组织各次尝试
        opt 需要资料
            A->>K: 提交当前问题的检索请求
            K-->>A: 返回内容、来源和版本
        end
        A->>A: 分析与按需 profiling,产生修改后的候选代码
        A->>H: inferrsi run:提交本次对照实验参数
        H->>H: run_experiment:保存 run.lock.json、环境和源码身份
        H->>H: 经原有执行器运行基线/候选及质量命令,保存测量、日志和退出状态
        H->>H: 原有 evaluate 与 write_report:生成 evaluation.json、状态及报告
        H-->>A: 返回本次 run 目录与结果
        opt 调用方显式关联历史
            A->>H: campaign init/record/decide/log:提交轮次关联和决策
            H-->>A: campaign.json、rounds.jsonl、候选引用及显式日志
        end
        A->>A: 根据反馈选择下一次尝试,自己衔接跨轮预算和最终版本
    end
    A->>H: 对选定版本另调用 run 做最终检查
    H-->>A: 新的一次实验目录及其判定
    A-->>U: 汇总代码、各次结果和未验证范围
Loading

这条旧路径保留。本 PR 的新流程是下述普通项目与题库两条入口,底层执行器与旧路径复用。

改动后:普通项目完整流程

下图将原来的初始化、知识查询、每轮执行与判定合并,并一直画到独立 final 和结果交付。普通项目在当前 Agent 会话执行;题库默认使用全新会话的差异流程见下一节。

先准备条件,再调用 start;文件复制和状态初始化发生在 start 内部。 基线性能数值在后续评测时才产生。图中的 loop 表示 Agent 连续发起命令,Python 不会自动启动下一轮;final 通过相同执行链重新测量已保存的最佳版本。

session_command() 及执行/判定适配函数为本 PR 新增。Harness 通过注入的回调交回适配层,再调用 Benchmark;核心模块不直接互相导入。这里详细展开普通项目的 project.steps/inspect_step/assess,题库用自身的命令与判定协议替换这些步骤,复用同一个 Harness 控制器。

图中按组件组织:Harness 只画一列,同时表示优化过程管理、候选/状态记录和受控执行。底层 Infra 执行器作为 Harness 使用的实现设施展示在内部动作中;新增与复用的区别放在图下说明。

sequenceDiagram
    actor U as 用户
    participant A as 当前 Agent
    participant C as CLI 入口与适配层
    participant H as Harness
    participant B as Benchmark
    participant K as Knowledge

    U->>A: 提出项目优化目标和约束
    A->>A: 先读 RSI 入口,准备任务说明、输入、质量/性能脚本、指标和门槛
    Note over A,H: 第一阶段:start 内保存任务与基线,初始化本次运行;此时不测量性能
    A->>C: campaign start:提交文件、条件、源码范围、预算和停止规则
    C->>C: session_command:检查实验新目录、项目范围及参数
    C->>B: project.prepare:校验条件,复制任务说明和评测目录
    B-->>C: frozen/TASK.md、frozen/protocol/、配置和文件哈希
    C->>H: candidates.retain:复制声明范围内的原始代码
    H-->>C: frozen/baseline/ 与源码身份
    C->>H: initialize:建立计划、期限、空轮次和初始最佳候选
    H-->>C: plan.json、campaign.json、state.json
    C-->>A: 返回项目编辑路径、实验状态和下一步说明

    Note over A,K: 第二阶段:Agent 逐次发起若干 round,结束搜索后再发起一次 final
    loop 每次命令独立进入相同的执行与判定链路
        alt 继续搜索:准备一轮候选
            A->>A: 分析反馈,按需 profiling,明确本轮问题
            opt 需要资料且知识开关允许
                A->>C: campaign knowledge:提交查询、检索方式和上下文预算
                C->>H: capture_context:传入 KnowledgeReader
                H->>H: 检查运行状态、预算和知识开关
                H->>K: knowledge_capture 经 reader.collect 检索
                K-->>H: 返回资料正文、版本、来源和遗漏信息
                H->>H: 保存 knowledge/context-….json,更新 state.contexts 引用
                H-->>C: 返回留存引用与正文
                C-->>A: 返回可阅读的资料,供本轮分析使用
            end
            A->>A: 提出假设,修改声明范围内代码,形成候选
            A->>C: campaign round:提交候选路径、假设和可用用量
        else 搜索结束:独立复测
            A->>C: campaign final:提交停止原因和可用用量
            Note over A,H: final 使用留存的最佳版本;工作区未提交修改不参与
        end
        C->>H: evaluate_round:传入 round/final 标记,注入 execute 与 assess 回调
        H->>H: 核验文件、状态和预算,选择提交候选或留存最佳版本
        H->>H: 保存到 rounds/… 或 final/…;state.pending 记录本次待完成尝试
        H->>C: 调用 execute 回调,即 _session_execute → _project_execute
        C->>B: project.steps:根据固定配置生成本次评测步骤
        B-->>C: 基线/候选的质量、预热、交替测量命令
        loop 按固定步骤采集;拒绝或异常时停止本次采集
            C->>H: execute_trial:提交命令、源码目录、环境和期限
            H->>H: 调用底层 execute_command 启动脚本,脚本检查质量/计时并写 result.json
            H-->>C: 执行状态、退出码、耗时、stdout/stderr 与结果路径
            C->>C: 核对本步骤前后的源码身份,记录 source_checks
            C->>B: inspect_step:读取本步结果,检查格式、质量字段和性能值
            B-->>C: 返回继续采集或拒绝/异常及原因
        end
        C-->>H: 返回 execution;各步结果、日志和汇总执行记录已落盘
        H->>H: _settle:再次核验固定条件和候选身份
        H->>C: 调用 assess 回调,即 _session_assess
        C->>B: project.assess:提交本轮目录、固定配置和执行事实
        B->>B: 核对完整性与质量,重算中位数/提升比例,比较门槛
        B-->>C: assessment:判定、指标、质量标记、证据引用和原因
        C-->>H: 返回 assessment;此步骤不重新测量
        H->>H: 写 observation.json;round 更新最佳候选,final 记录独立复测结论
        H->>H: 更新 state.json、summary.json;执行不明/缺证据时标记 blocked
        H-->>C: 返回本次结果、最佳快照、剩余预算或 final 状态
        C-->>A: Agent 读取反馈,决定下一轮、处理阻塞或交付
    end

    Note over A,H: 第三阶段:读取实际完成的记录,展示并交付
    A->>C: dashboard:读取实验目录
    C->>H: Dashboard 读取本次运行的计划、轮次和 final
    H-->>C: 页面/离线 HTML,含优化曲线、已观测用量与 final 结果
    C-->>A: 返回展示产物;缺失数据保持未知
    A-->>U: 交付最佳代码位置、最终结果、曲线、消耗及未验证范围
Loading

这张流程图中,本 PR 改了什么

部分 本次变化
Harness 优化过程管理 新增 optimization.py、candidates.py,管理初始化、轮次、预算、候选快照、选优、恢复及 final
Harness 执行脚本 复用已有 execute_trial() 和 Infra 的 execute_command();前者补充环境参数透传。图中的启动进程、超时和日志能力来自这条原有执行链
Harness 知识留存与展示 复用已有 knowledge_capture.capture_context();扩展原有 Dashboard 读取新运行记录并展示曲线/final
CLI 与 Benchmark 接入 新增 session_command() 及执行/判定适配函数,连接新流程与 Benchmark 的任务准备、步骤和判定接口

以上是同一流程内部的新旧实现关系。原有 run → runner.run_experiment() 仍未转入新增优化控制器,不能由组件合并展示推导出所有旧路径已经统一。

初始化步骤及产物

步骤 输入/动作 产生什么、何时使用
Agent 准备 把用户目标落实为任务说明、可执行检查、输入和配置 调用 start 的真实文件与参数;不会自动从自然语言生成可靠的质量标准
project.prepare() 接收明确评测方案并复制 frozen/TASK.md、frozen/protocol/;返回文件哈希及指标/门槛配置
candidates.retain() 复制 --include 声明的源码/配置,核对复制前后身份 frozen/baseline/;后续作为原始实现参与对照
optimization.initialize() 接收任务配置和运行预算,建立开始时间、期限和初始状态 plan.json 固定计划,campaign.json 标识运行,state.json 保存动态状态;这里不测量性能
命令返回 把初始状态交回 Agent Agent 在指定项目中修改;普通项目不会新建 work/candidate.py

这些目录由代码规定,实验根路径由调用者提供。普通项目和题库共用三个控制 JSON,但 frozen/ 的内部布局不同。plan.json 当前同时保存任务条件与运行配置;这不表示任务规则和动态状态属于同一职责。

知识查询的边界

查询由 Agent 根据当前问题发起,可以多轮再次查询;没有“第一轮自动加载全部 skill”的规则,也不强制每轮检索或 profiling。知识关闭时该受管入口拒绝查询,不能据此证明 Agent 没有从其他来源获得知识。

执行与判定的边界

步骤/函数 具体做什么 输入 → 产物
evaluate_round() 检查预算/状态/声明范围,保存候选;final 选择留存最佳版本 工作代码或最佳快照 → rounds/round-NN/attempt-…/ 或 final/attempt-…/ 下的候选副本;state.pending
_session_execute() / _project_execute() 把固定规则转成执行器调用;普通项目分别运行基线与候选的质量、预热、交替计时步骤 固定脚本、配置、源码路径 → 实际命令与汇总执行记录;Qwen 题包由其评测脚本内部完成采样
原有 execute_trial() / execute_command() 启动脚本、控制期限、收集退出状态/耗时、保存日志;脚本按指定路径写结果 命令 → stdout.log、stderr.log、execution.json;脚本生成结果 JSON
普通项目 inspect_step() 读取一步的结果,检查执行是否完成、JSON/字段是否合法、质量是否明确通过 一步执行及结果 → 继续采集,或明确的拒绝/异常;不会推测崩溃原因
_settle() 验证任务/候选未变,然后调用传入的 assess;本次该参数就是 _session_assess 执行记录、文件路径 → 发起判定;捕获约定的判定异常并记为 INCONCLUSIVE
_session_assess() 选择普通项目或题包的 assess() 任务类型 → 对应判定函数的返回值;它自己不制定质量/性能规则
Benchmark 的 assess() 只读留存结果,执行该任务的完整性、质量和性能判定 固定条件 + 执行事实 + 结果文件 → assessment 字典
Harness 结算 保存成功/失败尝试;按固定方向更新当前最佳;执行不明或缺证据时阻塞;final 记录独立复测 assessment → 本轮 observation.json、全局 state.json、summary.json

“正确性、性能、有效性与拒绝原因”在普通项目中具体是:

  • 有效性:步骤及顺序是否完整、执行是否完成、源码一致性记录是否通过,结果文件和数值是否合法;缺失或无法解释的执行失败为 INCONCLUSIVE。
  • 质量:从固定质量脚本的 JSON 中读取指定布尔字段。候选明确不通过为 FAIL;基线不通过则无法建立有效对照。这里不重新推理质量含义。
  • 性能:基线/候选分别取计时或吞吐样本的中位数,按 minimize/maximize 算改善比例与加速比;普通项目需有正向改善且满足给定门槛。
  • 原因:例如 missing_or_invalid_result、missing_boolean_quality_evidence、invalid_metric、performance_gate_not_met。

Qwen 题包的 assess() 则核对全部 case、固定采样参数、源码身份、逐步误差和调用次数,并从原始时间样本重算综合加速比。实际张量比较发生在此前运行的题目脚本里。该题当前 PASS 表示完整有效且正确的评测;加速比低于 1 的有效结果也可返回 PASS,由 Harness 决定它能否替换当前最佳,不能把 PASS 一律解释为已加速。

结果存在哪里

产物 普通项目 当前 Qwen 题库流程
固定任务 frozen/TASK.md、frozen/protocol/、frozen/baseline/ frozen/ 下保存完整题包,包含 baseline.py、评测/参考/输入脚本
编辑位置 --repo 指定的项目目录 work/candidate.py
每轮候选 本轮目录下 candidate/ 多文件快照 本轮目录下 candidate.py
原始质量/测量结果 本轮 execution/<step>/result.json 本轮 measurement/result.json、源码快照与身份文件
执行事实 本轮 execution/execution.json 及逐步执行记录/日志 本轮 execution/execution.json 及日志
判定和过程记录 两者均写本轮 observation.json;运行根目录更新 state.json 和 summary.json 同左
图与最终展示 dashboard 读取上述记录,生成性能/用量曲线及独立 final 展示 同左

up_to 是轮次上限,结束必须说明原因;exact 要求完成固定轮数。final 不采用工作区里未提交的修改。操作成功退出不等于任务 PASS;应读取 assessment。recover 只读取已留存的待完成执行再结算,不重新启动测量。

题库:先派发到新会话,再完整执行 RSI

sequenceDiagram
    participant A as 发起 Agent
    participant B as Benchmark
    participant H as Harness
    participant N as 当前宿主
    participant E as 同一种 Agent 的全新会话
    A->>B: list/show 解析题目,明确预算、采样和知识开关
    B-->>A: 任务定义与使用要求;尚未创建优化实验
    A->>H: agents prepare/dispatch:保存任务指令并登记一次创建机会
    H-->>A: prompt.md、request.json、job 状态和创建许可
    A->>N: 创建新会话并发送任务,不复制父对话
    N->>E: 交付任务与配置
    N-->>A: 原生会话 ID 和回执
    A->>H: agents bind:保存原生会话关联
    E->>E: 读取 RSI 入口与题目,自行执行 benchmarks session start
    Note over E,H: 从初始化到检索、候选、round、final 和报告,完整复用上图;任务规则来自题包
    A->>N: 观察同一新会话,获取返回结果和实际可用用量
    N-->>A: summary、候选、final 证据及宿主回执
    A->>H: agents record:保存回执和返回的交付物
    A->>A: 核查交付结果并汇报,不重复执行强制 final
Loading

通用 Agent job 与优化实验是两个独立记录:前者保存派发及宿主状态,后者由执行会话创建并管理。任务指令写明运行时/题目版本、入口、环境和预算;通用 agents prepare 保存 prompt,不自动校验题包版本,执行 Agent 必须在 start 前核对。宿主完成不代表任务通过,缺少 final 时仍须报告不完整。

调用位置与新增/复用对照

以下链接固定到当前 PR 提交,可从图里的步骤直接找到实现:

图中步骤 代码位置 本次性质
命令分发 cli.py、参数注册 修改原文件,增加入口
项目/题库 start 装配 session_command 新增函数与文件
固定项目检查 project.prepare 新增
保存源码快照 candidates.retain 新增,基线/每轮/final 共用
初始化、轮次与结算 initialize、evaluate_round、_settle 新增控制器
注入执行/判定函数 session_command 调用 evaluate_round 新增装配
实际命令执行 execute_trial、execute_command 复用;前者新增环境参数透传
判定路由与规则 _session_assess、project.assess、Qwen assess 新增;规则由对应任务实现
知识留存 knowledge_capture.capture_context 复用;新控制器在其外检查预算/开关
Dashboard 读取新记录 load_dashboard 分支 修改原文件,新增状态格式适配
原有单次流程 runner.run_experiment 未修改,未转入新控制器

本次交付的具体能力

能力 交付内容
题库 双 NPU MoE forward、单 NPU 缩比 Qwen-Image 2.1 去噪、真实 1.7B 权重 Qwen3-TTS CustomVoice;专用代码和协议放在对应题包
共用流程 普通项目 campaign ... 与题库 benchmarks session ... 进入同一个 Harness 控制器
候选与预算 多文件/目录快照、最大化/最小化指标、固定轮数/轮次上限、final 时间预留、协议和源码漂移检查
失败与恢复 保留失败轮;明确的候选拒绝允许继续搜索;不明崩溃、超时或缺失证据保持 INCONCLUSIVE;恢复只收集已有执行,不重复启动
展示与消耗 dashboard 读取同一控制状态,展示性能曲线、已观测 token 累计和独立 final;未知用量不补零,整会话计数不与逐轮数据重复相加

Qwen 使用随机权重和内置输入;TTS 保留真实模型与音频输出。当前完整题库迭代适配为 Qwen,MoE/TTS 已有单候选入口,尚未自动获得完整 benchmarks session 适配。

新增 Python 文件:作用与调用场景

这里只列出本 PR 新增的 10 个框架与公共接入 Python 文件,说明其作用和调用场景。文件链接固定到当前提交。

这些文件不是在每次优化时全部执行。只有 Agent/调用方发起对应 CLI 操作或 Python API,才会进入对应代码;安装插件、打开仓库或仅发送一句自然语言请求不会直接触发全部脚本。cli.py、arguments.py、dashboard.py 等属于修改的已有文件,不计入本表;运行时生成的 candidate.py 也不计入源码新增文件。

表中的 campaign … 指新增的受管 start/knowledge/round/status/final/recover 流程。原有 run 仍是单次实验;当前只有 Qwen 具备完整题库 session 协议,MoE/TTS 的入口按各自单次评测协议使用。

框架与公共接入:10 个

新增文件 作用 由谁调用、什么场景触发
benchmark_operations.py 新增命令适配:连接题包、Harness 执行器和评测接口,组装两类新优化入口。 cli.main 在 benchmarks run、benchmarks session … 或受管 campaign start/round/final 等操作中调用。
benchmark/init.py 声明 Benchmark Python 包,没有业务执行逻辑。 Python 导入 inferrsi.benchmark 或其子模块时加载。
benchmark/registry.py 读取题库注册表,定位题包资源,返回任务说明。 benchmarks list/show,以及 run 或题库 session start 查找题包时调用;发现任务不加载 NPU 模型。
benchmark/optimization.py 冻结题包文件,加载该题提供的迭代评测协议。 题库 session start 调用 prepare;round/final/recover 经适配层加载题包协议。普通项目使用 project.py 的协议。
benchmark/project.py 冻结项目明确提供的验收方案,生成检查步骤,读取留存质量/性能结果并判定。 普通项目 campaign start 准备协议;round/final 使用步骤和判定;recover 读取已有结果。不会自动生成质量标准。
harness/optimization.py 共用优化控制器:轮次、预算、候选记录、反馈、选优、恢复和独立 final。 受管 campaign … 与 benchmarks session … 共用;dashboard 也读取其记录。原有单次 run 不自动进入多轮控制器。
harness/candidates.py 检查声明输入范围,计算文件/目录身份,保留候选快照并检测变化。 start 适配函数调用它保存基线;控制器在 round/final 保存候选,读取状态和恢复时核验留存版本。
harness/agent_sessions.py 保存原生会话交接请求、一次创建许可、宿主 ID、回执与交付物。 agents prepare/dispatch/bind/record/status;题库先用同一通用入口派发任务,子会话随后自行 start。实际创建由发起 Agent 调用宿主工具。
harness/usage.py 规范化实际导出的用量字段并汇总;缺失保持未知,缓存输入不重复计算。 优化记录/摘要和原生会话处理用量时调用;已有 skill_evaluation、improvement 也复用。不会自动读取宿主账单。
harness/optimization_chart.py 把已保存记录画成优化目标/token 曲线,展示独立 final 结果。 dashboard.py 渲染受管 campaign 页面时调用;不执行评测或启动 Agent。

验证结果

本轮修改删除题库专用 handoff,使用通用 Agent job 先派发、子会话从 start 执行到 final。OS 文件锁下沉 Infra,使宿主会话记录与优化控制器解耦。修复 Qwen 将未知 NPU/运行时错误误判为候选错误的问题:仅明确的输出契约检查判 FAIL,其余执行异常为 INCONCLUSIVE。

  • 当前源码的独立技术复查未发现剩余阻塞;作者本人的检查是 self-check,均不代替独立账户的正式 GitHub 审批。
  • 本地定向回归覆盖通用 Agent job、题库/普通项目共享控制器、Qwen worker/协议及核心 import 边界;Ruff、diff 检查通过。原生交接测试使用合成宿主回执和真实测试子进程,不是真实 Agent 性能结果。
  • 本轮文档与 PR 时序图完成 Mermaid 语法检查。真实两组 Agent/NPU 优化仍需完成,不用历史实验替代。

下列是较早提交的软件验证,保留其原始验证范围:

验证对应提交 0b7883e89f180c58a5055b1fe0ee02d05f0608e7:

  • Linux CI 的 Python 3.10/3.11 完整测试、Ruff、独立 wheel 安装及 PR 引用检查均通过,包含 POSIX 可执行 helper 的快照验证。
  • 独立本地切片复审:118 项通过、2 项跳过,覆盖项目/题库共用流程、原生会话交接、Qwen 判定、dashboard、两种插件和核心 import 边界。冻结目录新增文件、候选错误分类、终止耗时、展示脱敏及 final 展示问题均已修复复验;这不是 GitHub 正式审批。
  • 两种独立插件包和干净 wheel 环境均完成多文件合成项目的轮次提交、留存版本 final 和 dashboard 导出。曲线与独立 final 结果做过实际渲染检查。
  • Windows 全量测试遇到既有平台敏感失败后停止;在改动前 8baed1a5 定向复现 21 项已知失败,涉及 CRLF 假设、FIFO/symlink 和旧 skill-eval 预期。未把本地全量标为通过。

这些合成指标验证软件流程及拒绝路径,不是新的 NPU 收益或 RSI 效果证据。

本轮真实宿主 / NPU 验证(2026-11-11)

当前提交 3cbb74f5f87ba4bbfe54a972a9e9e9b86e5b0ab3 的 Python 3.10/3.11 full-check、installed-package、pr-references 和 declarations 均通过。独立技术复查未发现本次修正的剩余阻塞,不能代替正式 GitHub 审批。

两组均通过宿主能力创建全新 GPT-6.1 Sol/high 会话,串行、无父对话与跨组方案输入。固定同一题包/runtime、8 轮 + 独立 final、pairs=2/samples=3/warmups=1;每组总预算 240 分钟,单次评测 1800 秒,其中自动单卡预约等待 10 分钟、运行上限 18 分钟。

  • 原始基线的 NPU 环境预检退出码 0,五个 case 的正确性与完整覆盖通过。
  • 知识开启组自行 start、检索知识并提交首个候选;知识关闭组自行 start、未调用受管知识检索并提交首个候选。
  • 两组首轮均因设备分配等待超时而未启动候选评测,保留为 infrastructure_failure / INCONCLUSIVE,campaign 为 blocked。各留存 1/8 次尝试,成功候选评测均为 0,独立 final 均未执行。
  • 子会话按 recover 契约收集现有记录并导出交付物;父会话回收,不另做强制 final。宿主完成不等于优化验收通过。

这验证了真实会话交接及环境失败路径,不是完成的 RSI 效果对照。没有候选加速比或有效优化曲线,不把初始 baseline 选优分数 1.0 当成测量结果。原始日志和实际可用 token 计数保留在私有实验目录,不提交仓库;完整 8 轮对照待资源可用后重新验收。

当前限制与后续验收

  • 普通项目需要真实且充分的质量/测量脚本,并确认脚本执行的是留存候选。外部权重、数据、服务、环境资格和统计显著性不会自动获得验证。
  • 受管 CLI 检查预算和状态;入口文档引导 Agent 调用它,但不能保证所有 Agent 行为都进入记录。知识关闭约束受管检索,不能证明没有读取其他来源。
  • 原生会话截止时间由发起 Agent 观察并使用宿主能力处理,没有后台强制终止器。逐轮 token 需要实际增量导出,缺失保持未知。
  • 之前 8baed1a5 的真实宿主会话验证覆盖入口/CLI/产物交接;21b0a4f0 的 Qwen NPU 控制包含一次预约超时的 blocked 会话及单独的有界候选/final 回放。这些不改称本次提交的新设备验证。
  • 共享项目路径的真实 Agent/NPU 完整验收、控制变量的 RSI 效果比较、MoE/TTS 迭代适配、MoE 可移植设备验证、真实 TTS 生成/官方 PCM 对齐和独立 ASR/说话人质量检查仍待完成。私有实验材料不提交到仓库。

详细文档

Refs #252
Refs #336
Refs #337

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

Scoped draft review of the new CPU benchmark measurement path against #252 and the campaign no-output-replay rule in #30. P2 benchmark-validity concern is attached inline: the precheck and timed samples reuse the same input object/content, so a memoizing candidate can appear faster without performing the operation on each call. Please address or explicitly constrain this before treating timing as optimization evidence. Static source review only; no tests, model runs, hardware measurements, or acceptance decision made here. The initial task subset remains subject to the recorded owner decision.

if profiler:
profiler.enable()
started = time.perf_counter_ns()
output = compute(x, eps=oracle["eps"])

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.

P2 — measured calls can become cached-output replay. The precheck at line 94 already invokes compute(x), and this loop passes the same x object and values to every warmup/sample. A candidate with a process-local id(x)/content → output memo can pass every value/input-preservation assertion while most timed calls only return the stored output; the reported suite_latency_ms then measures replay, contrary to the campaign's no-final-output-caching boundary (#30). Suggest preparing a frozen, paired varying input sequence outside the timing boundary (same sequence for baseline and candidate) and validating each invocation; add a stateful memoizing-candidate negative regression. Public development workloads still cannot establish hostile-code resistance or held-out generalization.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in ce84506e7106c4fc48fafdfab55d2ea2f9dffd50 with numpy-axis1-v2. Inputs/oracles are prepared before candidate invocation and retained for the complete action; each timed input has distinct bytes from precheck/warmup/other samples. Both arms and all consumers share the same deterministic per-call sequence. Each sample is bound to an input hash. The invariant zero case remains correctness-only, so the new score covers five varying workloads; old task/grader identities and evidence are preserved.

Regression controls confirm exact id/content memo implementations have no cache hits in the sequence, while shape/layout output replay is rejected without a metric. The fix does not claim hostile-code resistance. Forty focused tests and related CLI/SkillEval tests passed; actual Workbench and offline verifier execution retained 300 samples with matching planned and actual inputs. Statistical resolution remains unqualified.

Fix and validation · RSI consumer boundaries. Please re-review; this response does not mark the thread resolved or claim maintainer acceptance.

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.

The specific cached-output replay finding is addressed in ac03ae23; this is a scoped source confirmation, not approval of the whole draft.

  • Inputs and independent oracles are prepared before candidate calls. All input objects stay alive, and later inputs must have distinct bytes; the zero case is correctness-only and five varying cases contribute timing.
  • The new regressions require both identity-keyed and content-keyed memoization to miss, and reject stale shape/layout output replay without a usable performance metric. Per-sample input hashes and the frozen task/grader bindings are retained.
  • @Bounty-hunter remains the implementer. Full-PR review, v2 timing/noise qualification and the recorded parent scope decision remain open; this confirmation establishes neither reliable performance ordering nor optimizer/skill benefit.
Evidence and limits

Assessed head: ac03ae23ce0bb5864a55c2c97d5f3d8d3b550d39; API base and actual main: 663f3b327998526a13aa31e72ad729025c18983c.

Read the current task contract, NumPy evaluator, worker, consumer/verifier bindings, both task manifests and the regression definitions, including input preparation and memo/replay controls. This is not a completed review of all 42 changed files.

The Python 3.11 hosted job reports Ruff success and 3,584 passed / 13 skipped / 284 subtests. It checked out merge 396688581967ea85d8edf2f7f169925546c5e207 (current head into the main above); the API comparison returned zero file differences from the standalone head. Draft qualification was skipped. I did not rerun tests or independently inspect the author's local 300-sample archive. No model/device execution or scope acceptance occurred.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Skill evaluation

PLANNED: not executed; there are no task outcomes yet.
No approval, model efficacy or current-head test result is implied.

  • Next: resolve check applicability at head 3e4aa1f2f5225d287dfa54496081a0babdcee536.
  • Task selection: no supported automatic comparison; choose a relevant source/content check and disposition uncovered claims.
  • Selected comparisons: 0 · Estimated task calls: 0. Uncovered/unsupported changes: 108; Canonical library paths: 0; Generated projection paths: 0; Other paths: 108. These are paths, not independent claims.
  • Return: command, input/source pin, exit status, outputs/failures and untested claims for independent verified/refuted/unverified disposition.
Author verification steps (nonpaid; not yet run)
  1. Bind the checkout. Run git rev-parse HEAD; it must equal 3e4aa1f2f5225d287dfa54496081a0babdcee536. If it differs, obtain a current plan; do not reuse old results.
  2. Choose an applicable check. Match each changed behavior to the task below or a source/content check; a path match alone does not establish relevance.
    No supported automatic comparison is selected. Review the canonical changes and explain which claims need evidence, are unaffected, or remain unverified; do not treat generated records as separate behavioral claims.
    Uncovered scope by location: Canonical library paths: 0; Generated projection paths: 0; Other paths: 108. Path counts are not claim counts; no metadata-only conclusion is inferred.
  3. Return evidence for independent review: head, check/task/source pin, command, environment, exit status, outputs/failures and untested claims. Label scripted controls. Request each claim's disposition: verified, refuted or unverified; this plan proves neither model provenance nor benefit.
    Check recipes and evidence limits

Evidence and logs · Retention: 30 days.
Retained artifacts are verifiable only before Unix time 1796898113 while the linked artifact is available. Expired evidence is unverified.

Plan bindings, budget, frozen exam and advisory details

Advisory: obtain missing evidence

Retained evidence availability: planned / unexecuted. No approval or merge authorization is issued.
Applicable only while these revisions and inputs match the current PR.
Paid execution requires trusted label authorization and cumulative PR reservation. Unknown accounting blocks new paid calls; planning is not execution.
Pipeline evidence only; offline fixed outputs do not establish skill efficacy.
Unchanged-correct is valid neutral evidence, not incremental benefit.
Content/source review and authorship admission remain separate.
Trusted regrading checks retained answers, not model/hardware provenance or a hostile executor; this is not an efficacy certification.

  • Retained evidence is planned / unexecuted.
  • No supported comparison cases were selected.
  • Uncovered/unsupported scope needs a case or explicit reviewer disposition.
    Plan SHA-256: c98126d1b861f6b4fd9010c87f22696dbdd00dfcfd6026d98d8490a29d8c21b1
    Base: 14fa1f578655bbdcd101b8c4235299fc3d8360d3 · Head: 3e4aa1f2f5225d287dfa54496081a0babdcee536
    Trusted implementation: 14fa1f578655bbdcd101b8c4235299fc3d8360d3

Model/settings: {"effort":"not_applicable","name":"claude-opus-5-5"}
Budget: {"comparisons":0,"estimated_calls":0,"limits_per_comparison":{"campaign_seconds":600,"max_task_calls":2,"repeats":1,"timeout_seconds":180,"token_stop_new_trials":200000},"provider_config_sha256":"b28d80f8194fbe0f5a9f01515efb24b218979fd45f702776560da276f4b30d04","reservation":null}

Skill Comparison Cases Estimated calls

Automatic execution / cumulative PR budget:

{"reason":"Trusted configuration or pricing missing, invalid or expired","remaining_usd":"unknown","reserved_or_unresolved_usd":"unknown","spent_or_legacy_usd":"unknown","state":"blocked"}

Provider/settings: {"client":{"api_version":"2023-06-01","endpoint":"https://yibuapi.com/v1/messages","kind":"anthropic-messages-full-context-v1","max_output_tokens":4096,"max_read_bytes":32768,"max_request_bytes":262144,"max_requests":1,"max_tool_calls":12,"provider":"yibuapi"},"limits":{"token_stop_new_trials":200000},"model":{"effort":"not_applicable","name":"claude-opus-5-5"},"pricing":{"currency":"USD","expires_at":1793271228,"group":"default","max_input_tokens":1000000,"model":"claude-opus-5-5","rate_evidence":"https://github.com/InferMatrixLab/InferRSI/issues/215#issuecomment-6467531341","rates":{"cache_read":"0.4","cache_write":"10","input":"8","output":"40"},"request_fee":"0","unit":"per_million_tokens"},"spend_limit":{"amount":"200","currency":"USD"}}

Uncovered / unsupported paths (108)
  • uncovered: ".github/workflows/ci-ready.yml"
  • uncovered: "docs/architecture.md"
  • uncovered: "docs/engineering-benchmarks.md"
  • uncovered: "docs/engineering-task-artifacts.md"
  • uncovered: "docs/moe-forward-benchmark.md"
  • uncovered: "docs/operations.md"
  • uncovered: "docs/qwen21-denoise-benchmark.md"
  • uncovered: "docs/skill-eval-comparison.md"
  • uncovered: "docs/tts-benchmark.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/README.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/build_public.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/README.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/candidates.csv"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/exploration-candidates.zip"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/final/gpt56-kb-off.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/final/gpt56-kb-on.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/final/gpt61-kb-off.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/final/gpt61-kb-on.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/final/gpt6astra-kb-off.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/patch/final/gpt6astra-kb-on.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/plan/README.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/plan/integrity.json"
  • uncovered: "evidence/moe-agent-comparison-20261104/plan/provenance.json"
  • uncovered: "evidence/moe-agent-comparison-20261104/plan/publication.json"
  • uncovered: "evidence/moe-agent-comparison-20261104/render_overview.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/audit-extract.json"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/changes.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/comparison-overview.png"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/measurements.jsonl.gz"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/rounds.csv"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/session-usage.csv"
  • uncovered: "evidence/moe-agent-comparison-20261104/results/summary.json"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/README.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/runner/grade.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/task/TASK.md"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/task/baseline.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/task/oracle.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/task/task.json"
  • uncovered: "evidence/moe-agent-comparison-20261104/validator/task/workload.py"
  • uncovered: "evidence/moe-agent-comparison-20261104/verify.py"
  • uncovered: "pyproject.toml"
  • uncovered: "src/inferrsi/arguments.py"
  • uncovered: "src/inferrsi/cli.py"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/rmsnorm-npu/LICENSE"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/rmsnorm-npu/README.md"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/rmsnorm-npu/baseline.py"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/rmsnorm-npu/candidate.py"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/rmsnorm-npu/task.json"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/softmax-cpu/LICENSE"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/softmax-cpu/README.md"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/softmax-cpu/baseline.py"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/softmax-cpu/candidate.py"
  • uncovered: "src/inferrsi/data/engineering_benchmarks/softmax-cpu/task.json"
  • uncovered: "src/inferrsi/data/engineering_scenarios/moe-forward-npu/LICENSE"
  • uncovered: "src/inferrsi/data/engineering_scenarios/moe-forward-npu/TASK.md"
  • uncovered: "src/inferrsi/data/engineering_scenarios/moe-forward-npu/baseline.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/moe-forward-npu/oracle.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/moe-forward-npu/task.json"
  • uncovered: "src/inferrsi/data/engineering_scenarios/moe-forward-npu/workload.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/LICENSE"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/NOTICE.md"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/TASK.md"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/baseline.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/benchmark.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/reference.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/task.json"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/workload.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/LICENSE"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/TASK.md"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/baseline.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/inference.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/model-assets.json"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/service.py"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/sources.json"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/task.json"
  • uncovered: "src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/workload.jsonl"
  • uncovered: "src/inferrsi/harness/benchmarks/init.py"
  • uncovered: "src/inferrsi/harness/benchmarks/cli.py"
  • uncovered: "src/inferrsi/harness/benchmarks/consumers.py"
  • uncovered: "src/inferrsi/harness/benchmarks/contract.py"
  • uncovered: "src/inferrsi/harness/benchmarks/npu_task.py"
  • uncovered: "src/inferrsi/harness/benchmarks/numpy_task.py"
  • uncovered: "src/inferrsi/harness/benchmarks/skill_verifier.py"
  • uncovered: "src/inferrsi/harness/benchmarks/tts.py"
  • uncovered: "src/inferrsi/harness/benchmarks/worker.py"
  • uncovered: "src/inferrsi/harness/scenarios/_moe_processes.py"
  • uncovered: "src/inferrsi/harness/scenarios/moe.py"
  • uncovered: "src/inferrsi/harness/scenarios/moe_grader.py"
  • uncovered: "src/inferrsi/harness/scenarios/tts.py"
  • uncovered: "src/inferrsi/harness/skill_eval_benchmark.py"
  • uncovered: "src/inferrsi/harness/skill_eval_engineering.py"
  • uncovered: "src/inferrsi/harness/skill_evaluation.py"
  • uncovered: "tests/check_installed.py"
  • uncovered: "tests/test_engineering_benchmarks.py"
  • uncovered: "tests/test_evidence_inventory.py"
  • uncovered: "tests/test_moe_benchmark.py"
  • uncovered: "tests/test_npu_engineering_benchmark.py"
  • uncovered: "tests/test_qwen21_task.py"
  • uncovered: "tests/test_skill_eval_benchmark.py"
  • uncovered: "tests/test_skill_eval_benchmark_compare.py"
    Additional paths omitted; see retained evidence.

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

Incremental review at fd0f396c of the formal artifact integration since ac03ae23: one P2 correctness blocker, attached inline. The new built-in-only adapter can resolve a same-named working-directory task instead of the packaged task, and its freeze/revalidation path preserves that substitution.

The earlier cached-output replay finding remains addressed; I am not reopening or duplicating it. I inspected the new adapter, reused task/sandbox contracts, controller/run-trial/local-capture/report changes, regression definitions and CI wiring. Current Ready CI succeeds: the dedicated Linux controls report 49 passed with strict sandbox availability enabled; the 3.11 full check reports 3,631 passed, 18 skipped and 284 subtests. Actual checkout 98156741 has zero file differences from this head. Those tests do not cover cwd task shadowing.

Static source review plus existing hosted logs only; no local candidate/test execution, model or hardware work. Bounty-hunter retains the correction. Correctness-only limits, performance/skill-benefit gaps and #252's outstanding acceptance decision remain separate; this review does not accept the broader goal.

def task_descriptor(name: str) -> dict:
if name not in builtin_tasks():
raise ValueError("Only built-in shared CPU benchmark tasks are supported")
package = load_task(name)

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.

P2 — resolve formal tasks from the packaged resource, not the working directory. Checking that name occurs in builtin_tasks() does not ensure that load_task(name) loads that built-in package: contract.load_task first prefers any existing Path(name) directory. validate_task(), starter() and verify() repeat the same lookup, so they all agree on a shadow rather than detect it.

For a concrete source-trace case, run from the InferRSI checkout with a local softmax-cpu/ copy of the packaged task and change only its oracle.atol to 1. Generate the descriptor through task_descriptor('softmax-cpu'). The manifest validator permits that positive finite tolerance. prepare() copies this same package, freezes its checkout-relative paths, and load_plan() compares against the same shadow, so the paired path also accepts it. A compute returning np.zeros_like(x) then satisfies all four output checks for every input: true softmax values lie in [0,1], so np.allclose(0, expected, atol=1) accepts them. The canonical packaged files need not change. This is static tracing/arithmetic, not a claim that I executed the candidate.

This makes a built-in-only, independently frozen correctness task depend on the caller's cwd and allows an incorrect artifact to pass under an accidentally or deliberately substituted rubric. It is separate from the documented public-suite/protocol-spoofing limits. Please use an explicit packaged-resource/built-in-only loader throughout the formal adapter and its prepare() dependency collection, while retaining path loading for the trusted Workbench API. Add a regression with a same-named cwd task directory that proves the canonical oracle/hash is used or the shadow is rejected.

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.

The specific cwd-shadowing finding is addressed at 6308268fc6d1fbf90e9ab97b5da8af79152f39ea (fix introduced in 00c41b24). This clears this finding only.

  • load_builtin_task() resolves the packaged resource and checks its manifest ID. The formal descriptor, starter and parent verifier now use task_package(); prepare copies and freezes dependencies through that same canonical loader. Revalidation compares the retained package hash and starter against the canonical descriptor. Trusted Workbench path loading remains available.
  • The new regressions cover a same-named softmax-cpu/ cwd directory with atol=1, canonical descriptor/starter/oracle selection, prepare/dependency freezing and later revalidation. The real sandbox control rejects the zero-output implementation despite that shadow. The formal CPU path also rejects the new NPU adapter before execution.
  • I read the exact-head source and dedicated Linux control log: 54 passed, zero skips, with INFERRSI_REQUIRE_BENCHMARK_SANDBOX=1 and NumPy 2.2.6. The 3.11 full check reports 3,649 passed / 20 skipped / 284 subtests. CI checked out merge 6f1506bc; its tree has zero file differences from this head. I did not execute code locally.

The separate NPU action/total-timeout finding remains open and is not superseded by this reply. This is not whole-PR approval, device qualification, performance/skill-benefit evidence, or scope acceptance; Bounty-hunter retains the implementation.

@Bounty-hunter Bounty-hunter changed the title feat: add shared CPU engineering benchmark tasks feat: add shared CPU benchmarks and formal SkillEval artifact checks Nov 4, 2026

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

Scoped incremental static review of the new rmsnorm-npu pilot in PR #338 (head 6308268f), against the execution limits recorded in Issue #337. One P2 execution-budget contract gap, attached inline: the 180-second action timeout is applied to standalone check/profile/negative controls but not to the A/A or reference Workbench trials. This can leave an individual trial running until the 8-minute comparison deadline; the script also does not itself enforce the separately stated 20-minute pilot envelope. Please bind the per-action and total deadlines or identify and verify the outer enforcement, with a timeout-control regression. This is a source/contract finding, not a hardware result. I inspected the new NPU adapter/driver, RunSpec, the Workbench runner/external/local executor chain and relevant tests. The earlier canonical-task shadowing review remains separate and is not repeated. No NPU/model/test execution or acceptance decision was performed.

Comment thread tools/npu_benchmark_validate.py Outdated
comparisons = {}
# Same implementation in both arms is the explicit no-op/A-A control.
for name, path in (("aa", baseline), ("reference", candidate)):
spec = task.runspec(path, repo=args.repo, output_dir=output / "results" / name,

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.

P2 — the frozen per-action timeout is not applied to paired NPU trials. Issue #337's predeclared pilot says --timeout-seconds 180, two Workbench comparisons capped at 8 minutes each, and a 20-minute total runtime. Here args.timeout_seconds is passed only to run_action() for check/profile/negative controls (lines 96–116); task.runspec() does not carry it. run_experiment() passes its whole-comparison deadline to execute_trial() → execute_command(), which calls process.wait(timeout=deadline-now). Thus a first stalled A/A or reference trial may occupy almost the entire 480-second comparison instead of stopping at 180 seconds; two comparisons plus all standalone controls can also exceed 20 minutes unless an independently enforced outer deadline exists. That changes the frozen resource/lifecycle budget, particularly on a shared NPU allocation. Please cap each Workbench trial at min(comparison_remaining, action_timeout, pilot_remaining) (or implement equivalent tested enforcement), and include a deliberately nonterminating synthetic command in a CPU-only timeout regression. If a scheduler supplies the global bound, record its enforceable receipt and distinguish that from this script's guarantees.

@Bounty-hunter Bounty-hunter changed the title feat: add shared CPU benchmarks and formal SkillEval artifact checks feat: add NPU RMSNorm pilot and shared benchmark evaluation Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Review at head a91b913e (draft): not approving yet.

  1. Per-action timeout still not applied to paired NPU trials (tools/npu_benchmark_validate.py:101 vs :117-120): args.timeout_seconds is passed to run_action() for check/profile/negative controls, but the aa / reference comparisons build task.runspec(...) and call run_experiment(spec, ...) without it. Issue task: connect engineering tasks to existing Agent execution and evaluation #337's predeclared limits (--timeout-seconds 180, 8 min per comparison, 20 min total) therefore do not bound the paired trials. This is the open Dong1017 finding from 2026-11-04 03:02 UTC; the head has no later code commit. Expected: thread the timeout into the runspec/trial launcher and add a test.
  2. Scope question: the PR is +24,166 lines across 76 files (CPU benchmark path, formal Skill Eval adapter and the NPU RMSNorm pilot/evidence). Is the evidence part within the evidence byte budget discussion in [Investigation] Agent-led workflow gaps: closure, decision visibility, review provenance and focus #273, and should the pilot evidence be split from the harness change for review?
  3. The PR is still a draft; please mark it ready once the above is resolved so the Ready checks run.

@Bounty-hunter Bounty-hunter changed the title feat: add NPU RMSNorm pilot and shared benchmark evaluation feat: add shared engineering task evaluation and Ascend RMSNorm Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Incremental review a91b913e..125b0645 (draft; one docs-only commit, docs: consolidate task library and evaluation integration plans), checked against my previous review. Not approving yet.

This delta: the 12 files under docs/plans/issue-252/ consolidate #334/#335 into #336 (task library) and #337 (integration), make profiling an optional diagnostic for the general flow while keeping the frozen profiling checks of the executed NPU pilot, and add an explicit tracker for remaining work. I did not find broken relative links in the changed text (e.g. task-expansion/README.md now points at ../README.md, which resolves to the #252 overview). The wording is careful not to count closed issues as accepted work. CI at 125b0645 is green.

Still open:

  1. Per-action / total timeout for paired NPU trials (tools/npu_benchmark_validate.py:101 vs :117-120): no code change in this delta. The docs now record it as unresolved (03-tasks.md tracker, 04-integration.md last paragraph, README.md, npu-validation.md), which is accurate, but the fix itself is still needed: thread --timeout-seconds into the runspec/trial launcher for the aa / reference comparisons, enforce the overall budget, and add a test.
  2. Scope / size question from last round is not answered yet: is the pilot evidence within the [Investigation] Agent-led workflow gaps: closure, decision visibility, review provenance and focus #273 evidence byte budget, and should the evidence be split from the harness change for review?
  3. The PR is still a draft; please mark it ready once 1 is fixed so the Ready checks run.

Static doc review of the delta only; I did not run the NPU tooling.

Copy link
Copy Markdown
Collaborator

Incremental review 125b0645..9a755f97 (draft; one commit, chore: remove the built-in CPU RMSNorm task), checked against my previous review. Not approving yet.

This delta looks consistent:

  • The rmsnorm-cpu package and tests/fixtures/engineering_benchmark_usefulness.py are removed; tests/test_engineering_benchmarks.py now asserts builtin_tasks() == {"softmax-cpu", "rmsnorm-npu"} and that loading rmsnorm-cpu fails explicitly.
  • Tests migrated to softmax-cpu. In tests/test_skill_eval_benchmark_compare.py the two-task run is replaced by repeats=2 with a per-repeat mode key, which keeps the AB/BA order check ([1, 1, 2, 2]) and the fix/unchanged-correct counts with one task. The cached-output replay control is rewritten as a Softmax memoizer, so that regression is still covered.
  • tools/engineering_benchmark_validate.py iterates builtin_tasks(), so no stale rmsnorm-cpu reference there. CI at 9a755f97 is green.

Still open:

  1. Per-action / total timeout for paired NPU trials (tools/npu_benchmark_validate.py:102-103 vs :121-126): unchanged in this delta. --timeout-seconds still reaches run_action() only; the aa / reference comparisons call task.runspec(...) + run_experiment(...) without it, and the 20-minute pilot envelope is not enforced. Please thread the timeout into the paired trials, bound the total, and add a test.
  2. Scope / size question from the last two rounds is still unanswered: is the pilot evidence within the [Investigation] Agent-led workflow gaps: closure, decision visibility, review provenance and focus #273 evidence byte budget, and should it be split from the harness change?
  3. Historical links point at a fork commit (docs/plans/issue-252/walkthrough.md, new links to Bounty-hunter/InferRSI/tree/125b0645...): after a squash merge that commit will not exist in this repo and depends on the fork staying alive. Could you pin these to a commit that will be in InferMatrixLab/InferRSI (e.g. the pre-removal commit once merged), or confirm the fork is the intended permanent record?
  4. Still a draft; please mark it ready once 1 is fixed so the Ready checks run.

Static review of the delta only; I did not run the tests or the NPU tooling.

Copy link
Copy Markdown
Collaborator

Incremental review 9a755f97..6ed93bb4 (draft; one docs commit, docs: keep benchmark usage separate from development archives), checked against my previous review and the follow-ups at 125b0645 / 9a755f97. Not approving yet.

This delta:

  • Removes all of docs/plans/issue-252/ (plans, JSON summaries, profiles, walkthrough) and the matching .gitattributes byte-preservation rules; the PR is now 39 files with no retained evidence dumps. That answers my earlier size / [Investigation] Agent-led workflow gaps: closure, decision visibility, review provenance and focus #273 byte-budget question, and the fork-commit links in walkthrough.md are gone with it.
  • Rewrites docs/engineering-benchmarks.md and adds docs/engineering-task-artifacts.md (CPU SkillEval handoff); docs/skill-eval-comparison.md now links there. I found no remaining references to plans/issue-252 in the PR diff. CI at 6ed93bb4 is green.

Still open:

  1. Per-action / total timeout for paired NPU trials (tools/npu_benchmark_validate.py ~L103 vs L122-125): the code is unchanged; --timeout-seconds still reaches only run_action(), and the aa / reference comparisons go through task.runspec(...) + run_experiment(...) without it. The new text in docs/engineering-benchmarks.md ("Qualify the tools with authored controls") now states this limitation explicitly, which is accurate, but Issue task: connect engineering tasks to existing Agent execution and evaluation #337 predeclared 180 s per action and a 20-minute pilot envelope. Either thread the timeout into the paired trials and enforce the total (with a test), or get an explicit decision on task: connect engineering tasks to existing Agent execution and evaluation #337 that documenting the gap is acceptable for this PR. Documentation alone does not close it in my view.
  2. Where the pilot evidence lives after merge: the commit message says "Historical records remain available at their original revision", but those revisions are branch commits on the fork. After a squash merge they will not be in InferMatrixLab/InferRSI, and [Tracking] Minimal engineering benchmarks shared by Workbench, SkillEval and SearchSpace experiments #252 / task: connect engineering tasks to existing Agent execution and evaluation #337 currently point at results that were in docs/plans/issue-252/. Could you name where the NPU pilot and CPU replay evidence should be retained permanently (e.g. an evidence/ directory per the contributing conventions, a release artifact, or a pinned commit that will exist on main), and update the issue links accordingly?
  3. Still a draft; please mark it ready once 1 is settled so the Ready checks run.

Static review of the delta only; I did not run the tests or the NPU tooling.

@Bounty-hunter Bounty-hunter changed the title feat: add shared engineering task evaluation and Ascend RMSNorm feat: add shared engineering evaluation and dual-NPU MoE task Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Incremental review 6ed93bb4..3266e153 (draft; three new commits: 3eeac85d MoE comparison evidence, 298de775 two-rank MoE task + local evaluator, 3266e153 consumption fix), checked against my previous review and the follow-ups at 125b0645 / 9a755f97 / 6ed93bb4. Not approving yet.

This delta: adds the moe-forward-npu scenario under src/inferrsi/data/engineering_scenarios/, the evaluator src/inferrsi/harness/scenarios/moe.py (+ _moe_processes.py marker-based torchrun cleanup, moe_grader.py), python -m tools.moe_benchmark, tests/test_moe_benchmark.py, and the evidence/moe-agent-comparison-20261104/ bundle registered in tools/evidence_inventory.json. The adjudication logic reads well: both ranks are recomputed from raw calls/samples, timing uses the slowest rank, frozen identities are re-hashed after execution, and the new 3266e153 fix keeps round_consumed=true when a peer leaves a truncated record (covered by test_malformed_peer_does_not_erase_consumed_candidate). pyproject.toml package-data now includes data/engineering_scenarios/**/*.py, and tests/check_installed.py checks the resources ship.

Findings / questions:

  1. CI is red at this head: full-check (3.11) failed in the Tests (smoke + unit) step (job); full-check (3.10) was still running when I looked. I could not read the job log without auth, so I don't know which test fails. Please fix or explain before re-review.
  2. Non-string phase / failure_kind can still lose the candidate-failure status (src/inferrsi/harness/scenarios/moe.py L196-197): the loop above (L188-193) now guards with isinstance(..., str), but failed = any(r.get("phase", "").startswith(...) or r.get("failure_kind", "").startswith(...)) still raises AttributeError when a rank writes "phase": null (or any non-string). It is caught by the outer except, so the result stays status="infrastructure_failure" even if the other rank recorded failure_kind="candidate_...", and main() then exits 1 instead of 2. Suggest reusing the same isinstance guard there and adding a parametrized case with phase=None.
  3. Still open from earlier rounds: paired NPU trial timeout (tools/npu_benchmark_validate.py, ~L103 vs L122-125): unchanged in this delta. --timeout-seconds still reaches only run_action(); the aa / reference comparisons via task.runspec(...) + run_experiment(...) are not bounded, and the task: connect engineering tasks to existing Agent execution and evaluation #337 20-minute envelope is not enforced. Thread the timeout through and add a test, or get an explicit decision on task: connect engineering tasks to existing Agent execution and evaluation #337 that documenting the gap is acceptable.
  4. Evidence location / size: the new evidence/ bundle is the right place for the MoE comparison, thanks. Two follow-ups: (a) where does the earlier RMSNorm NPU pilot / CPU replay evidence (previously under docs/plans/issue-252/) live permanently now? (b) the bundle adds ~560 KB of binaries (results/comparison-overview.png ~418 KB, patch/exploration-candidates.zip ~75 KB, results/measurements.jsonl.gz ~70 KB). Is that within the evidence byte budget discussed in [Investigation] Agent-led workflow gaps: closure, decision visibility, review provenance and focus #273, or should the PNG be regenerated from render_overview.py instead of committed?
  5. Scope: this push adds a second, independent deliverable (distributed MoE scenario + six-session evidence) to a PR that is already large and still has an open blocker in the RMSNorm path. Would you consider splitting the MoE scenario/evidence into its own PR so each can be reviewed and merged on its own evidence? Not a blocker by itself, but it would make 3 easier to settle.
  6. Still a draft; please mark it ready once 1 and 3 are settled so the Ready checks run.

Static review of the delta only; I did not run the tests, the NPU tooling or the MoE evaluator.

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

Scoped follow-up at 2eed487a to Amy's CI question: the evidence-inventory count is now repaired, but both current-head full checks still fail in detached-worker cleanup. The new diagnostics identify a process-discovery failure before any worker is signalled; the P2 below needs correction. The previously reported malformed-field classification and RMSNorm timeout findings remain separate and are not cleared by this review.

CI evidence and scope
  • Inspected head: 2eed487a1edcac30a3a32b5a504bc7b013e9616b; incremental commit only changes inventory totals and assertion diagnostics.
  • Python 3.10 log and Python 3.11 log: each reports 1 failed, 3,682 passed, 19 skipped. The sole failure is test_deadline_cleans_detached_workers_but_preserves_unrelated_process, with verified: false, signalled_pids: [], and permission denied reading a same-user /proc/.../environ.
  • Read the affected cleanup code, test and hosted logs. No local execution, hardware/model run, or new spending.

fields = (entry / "stat").read_text().rsplit(")", 1)[1].split()
if fields[0] == "Z":
continue
if marker in (entry / "environ").read_bytes().split(b"\0"):

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.

P2: An unreadable same-user process prevents cleanup of the invocation's workers. _members() scans every same-UID process, and a permission error reading any environ propagates before it returns its accumulated matches. cleanup() therefore reaches its outer exception handler without signalling even the marked workers it could inspect. Both current-head Linux jobs reproduce this after the launcher times out: verified=false, signalled_pids=[], with /proc/.../environ permission denied. This can leave detached workers running and makes the standard Linux qualification fail. Scope discovery to an inspectable invocation-owned process set, and ensure a partial scan still attempts cleanup of positively identified workers. Preserve an inconclusive result when absence cannot be established; do not merely ignore unreadable entries and report verified success. Add coverage for an unreadable unrelated same-user process.

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.

Scoped follow-up at 8f3aebd2e1359d11d8bcdd034f5dacedf9a1f12d: the original hosted-CI failure is cleared, but this P2 is only partially fixed.

Both Python 3.10 and 3.11 now report 3,688 passed, 19 skipped. Skipping strictly older processes is sound for the fresh marker. However, an unreadable same-tick or newer process still prevents cleanup of workers already positively identified earlier in the scan.

I reproduced this with a synthetic procfs and mocked os.kill (no real signals): driver start tick 100, readable exact-marker worker PID 990001 at tick 101, then an unrelated same-UID process whose environ raises PermissionError. With the unrelated process at tick 100 or 101, cleanup() returns verified=false, signalled_pids=[], and the mock receives zero calls. At tick 99, it skips that unrelated environment and attempts to signal the known worker.

_members() still throws away its accumulated matches when the later read raises; cleanup() catches the exception outside the signalling loop. The new unreadable-process test has no owned worker, so it does not cover this consequence.

Please preserve discovered matches alongside scan errors, attempt cleanup of the PID/start-time-verified owned workers, and retain an inconclusive result for unreadable entries. Add the mixed owned-worker/unreadable-process case. This is the remaining part of the original finding, separate from Amy's malformed-field and whole-pilot timeout findings.

Copy link
Copy Markdown
Collaborator

Incremental review 3266e153..2eed487a (draft; one commit, test: register MoE evidence totals and expose cleanup diagnostics), checked against my previous review. Not approving yet.

This delta bumps the evidence inventory totals in tests/test_evidence_inventory.py (21→22 bundles, 430→460 hashes, matching the new evidence/moe-agent-comparison-20261104/ bundle) and splits the cleanup assertion in tests/test_moe_benchmark.py so the guard dict is printed on failure. Both look fine.

Findings:

  1. CI is still red at this head, and the new diagnostic shows why. Both full-check (3.10) (job) and full-check (3.11) (job) fail with one test:
    tests/test_moe_benchmark.py::test_deadline_cleans_detached_workers_but_preserves_unrelated_process → {'verified': False, 'signalled_pids': [], 'error': "[Errno 13] Permission denied: '/proc/1245/environ'"}.
    In src/inferrsi/harness/scenarios/_moe_processes.py, _members() (L29) reads /proc/<pid>/environ for every same-uid process, but its except (L31) only catches FileNotFoundError / ProcessLookupError. A same-uid but non-dumpable process on the runner (pid 1245 here) raises PermissionError, which escapes to cleanup()'s except OSError (L58-59) on the very first scan, so nothing is signalled and cleanup reports unverified. The comment at L33 says this fail-closed behaviour is intentional, but as written it makes cleanup unusable on any host with such a process, which likely includes the NPU hosts too. Could you decide which behaviour you want and make CI reflect it? For example: skip unreadable processes that are not descendants of the launcher (or whose session/pgid cannot belong to this run), still kill the readable marker matches, and report the unreadable PIDs as inconclusive instead of aborting; or, if fail-closed is truly required, make the test set up an environment where that holds and add a separate test for the PermissionError path. I have not verified which processes pid 1245 is on the runner.
  2. Still open: non-string phase / failure_kind (src/inferrsi/harness/scenarios/moe.py L196-197): unchanged in this delta; see item 2 of my previous review.
  3. Still open: paired NPU trial timeout (tools/npu_benchmark_validate.py ~L103 vs L122-125): unchanged.
  4. Still open: evidence location / binary size (earlier RMSNorm pilot evidence; ~560 KB of binaries in the MoE bundle vs the [Investigation] Agent-led workflow gaps: closure, decision visibility, review provenance and focus #273 byte budget): no reply yet.
  5. Splitting the MoE scenario into its own PR is still worth considering, and the PR is still a draft.

Static review of the delta plus the CI logs; I did not run the tests or the MoE evaluator.

Copy link
Copy Markdown
Collaborator

Incremental review 2eed487a..8f3aebd2 (draft; one commit, fix: bound MoE cleanup scans to fresh-marker process lifetimes), checked against my previous review at 2eed487a. Not approving yet.

This delta addresses item 1 of that review in a reasonable way:

  • _members() (src/inferrsi/harness/scenarios/_moe_processes.py L26-40) now reads the driver's own start time from /proc/self/stat and skips same-user processes with start_ticks < driver_start before touching their environ. Since evaluate() mints the token (moe.py L231) and calls cleanup(token) (L248) in the same process, a strictly older process cannot carry the marker, so skipping it is sound. Same-tick processes stay in scope, and an unreadable in-scope process still makes the result inconclusive (PermissionError reaches the except OSError at L71), which keeps the fail-closed intent.
  • The new tests cover the boundary (start_ticks 99/100/101 vs driver 100), the same-tick owned process, and PID reuse between enumeration and signalling. The field index (fields[19] = starttime, field 22) matches proc(5).

Remaining items:

  1. CI not yet settled at this head: full-check (3.10) and full-check (3.11) were still in progress when I looked. Please confirm test_deadline_cleans_detached_workers_but_preserves_unrelated_process passes on both before re-review. One residual case to keep in mind (question, not a blocker): a same-user process started after the driver with an unreadable environ (e.g. another job on a shared NPU host) still makes cleanup unverified. If that can happen on the target hosts, it may be worth documenting or reporting those PIDs separately.
  2. Still open: non-string phase / failure_kind (src/inferrsi/harness/scenarios/moe.py L198-199): unchanged; r.get("phase", "").startswith(...) still raises AttributeError for "phase": null, while the loop at L190-193 already uses an isinstance(..., str) guard. Please reuse that guard and add a phase=None case.
  3. Still open: paired NPU trial timeout (tools/npu_benchmark_validate.py): unchanged in this delta; --timeout-seconds still only bounds run_action(), not the aa / reference paired trials or the total pilot envelope.
  4. Still a draft; please mark it ready once the above is settled so the Ready checks run.

Static review of the delta plus surrounding source only; I did not run the tests or any NPU tooling.

@Dong1017

Dong1017 commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Structural question: two task libraries, two entry styles, two identity freezes

Reviewed at 8f3aebd2e1359d11d8bcdd034f5dacedf9a1f12d. Static reading of source, docs and packaging only — no tests run, nothing executed on a device. I have no comment on the MoE measurements themselves; this is about where the pieces live.

Edited. The original version of this comment claimed that both benchmark paths "inherit the runner's own source-snapshot adjudication" by reusing harness.scenarios.external. That was wrong, and wrong in the direction that matters — it asserted a check that is not there. Section 2 now states what each entry point actually verifies. The error was caught in the architecture thread; nothing else in this comment depended on it.

The MoE addition is documented as a deliberate separation, not an oversight: docs/engineering-benchmarks.md states the scenario "has a separate task contract and is not accepted by the single-operation benchmarks adapter." The question is whether that boundary is the one worth drawing, because the PR now carries two of almost everything.

1. Two parallel content libraries with the same file roles

data/engineering_benchmarks/ data/engineering_scenarios/
Entries rmsnorm-npu, softmax-cpu moe-forward-npu
Files LICENSE, README.md, baseline.py, candidate.py, task.json LICENSE, TASK.md, baseline.py, oracle.py, task.json, workload.py
Code harness/benchmarks/ (contract, worker, consumers, cli, numpy_task, npu_task, skill_verifier) harness/scenarios/moe.py (595), moe_grader.py (921), _moe_processes.py
Entry point inferrsi benchmarks list|show|check|measure|profile|grade|plan|compare python -m tools.moe_benchmark
Packaging data/engineering_benchmarks/**/*.py a second package-data line added for data/engineering_scenarios/**/*.py

Both hold the same kind of thing: a frozen task manifest, a baseline, a correctness oracle, a license and provenance. The stated distinguishing axis is single-operation versus distributed layer. That reads like a property a task declares, not a reason for a parallel tree — and task.json exists on both sides, so there is already a place to declare it.

Two costs are visible in this diff rather than hypothetical. pyproject.toml needed a second package-data entry, so a third scenario kind needs a third. And the boundary is now described in four places (engineering-benchmarks.md, moe-forward-benchmark.md, an architecture.md paragraph, an operations.md entry) while operations.md itself says it "is not a third primary matrix" — the navigation cost is already being paid.

The practical consequence: an agent has to know which library a task lives in before it can choose the invocation. For a task library that is the thing you most want to avoid.

2. Each entry point verifies something different, and the differences are not visible from the imports

moe.py freezes and re-checks identity on its own: _hashes (#L97) computes a sha256 map, _prepare (#L104) writes identity.json, and _adjudicate (#L356-L449) recomputes and raises on Rank/file identity mismatch or Frozen task, grader, request or candidate ....

Its imports are infra.artifacts, ._moe_processes and .external — it does not import harness/benchmarks/contract.py, which was added earlier in this same PR and already carries task_sha256 / candidate_sha256 / grader_sha256 and assert_unchanged.

These two are not interchangeable: contract.py binds execution identity against a pre-bound record for a single-operation task, while moe.py binds a multi-file, multi-rank set across a prepare/adjudicate boundary. Different protected objects, so "merge them" is the wrong ask.

What is worth checking is that reusing a shared execution helper conveys no upper-layer guarantee. execute_trial is a leaf executor — external.py#L12, importing only infra.artifacts, infra.executors.local and model.protocols.metrics, with no snapshot or integrity logic. The source-snapshot adjudication lives in the wrapper: runner.py#L16-L23 takes execute_trial as run_experiment's default execute, and the verdict-affecting check is in terminate() at #L95-L117. Both consumers.py (#L13 import, #L41 call) and moe.py (#L527) call execute_trial directly, so neither passes through that wrapper.

Per entry point, as read at this head:

Entry point Execution path Repo source-snapshot adjudication Parent-side identity verification
benchmarks plan / compare contract.runspec() → run_experiment yes, runner.terminate() yes, bound by runspec()
benchmarks grade grade_artifact → run_action → execute_trial no yes — task.identity() before and after, assert_unchanged(), plus the result's echoed identity; any mismatch leaves checks = None and the verdict INCONCLUSIVE
benchmarks check / measure / profile run_action → execute_trial no no — run_action builds the command and executes it
MoE moe.evaluate → execute_trial no yes, its own _prepare / _adjudicate

worker.py adds a further in-subprocess identity check for all of these; I read that by structure in an earlier pass and did not re-verify it line by line at this head.

That table is the useful artifact, and it is also the point: filling it per module produces the wrong answer, which is how I got the original claim wrong. It has to be filled per entry point. Nothing here says any of these entry points needs source-snapshot adjudication — grade arguably does not, since it compares identity directly. It says the guarantee set differs across entry points in ways the import graph does not show.

3. Three low-cost suggestions

None of these requires restructuring what is already here:

  1. Declare the contract in task.json. One field naming which adapter accepts the task, so a caller resolves the invocation from the manifest instead of from prose. This is the smallest fix for the "which library is it in" problem.
  2. State the axis in the names, or converge the entry style. benchmarks versus scenarios does not convey "single-operation versus distributed"; the docs have to carry that, in four places. Either rename to the axis, or expose the MoE path as a benchmarks-family subcommand so there is one entry style with a declared task kind.
  3. Record the guarantee set per entry point, in the shape of the table above. Protected object, applicable operation, identity field, invalidating event, enforcement site, counter-example test, retained consumers — the format being discussed in the architecture thread. Cheap now while both implementations are fresh, and it answers the reviewer question of whether the second freeze is intentional. It also stops the next adapter author from assuming, as I did, that reusing execute_trial carries the runner's checks.

4. What this comment does not claim

  • I did not run the test suite, the MoE evaluator, or anything on a device.
  • moe_grader.py (921 lines) and tests/test_moe_benchmark.py (343 lines) were read by symbol and structure only, not line by line.
  • benchmarks/contract.py and worker.py are byte-identical between 6ed93bb and this head, so earlier single-operation conclusions about them stand; the MoE path is additional rather than a revision of them.
  • No opinion on the six-condition comparison's conclusions. I note only that the bundle's own evidence_inventory.json entry states that original rank logs, condition/session access audits and host launch configuration remain outside the checkout, limiting independent replay — which is the right thing to have recorded.
  • The separation may well be the right call for reasons not visible in the diff. This is a request to write the reason down where a future adapter author will read it, not an assertion that it is wrong.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 8f3aebd to 3e4aa1f Compare November 10, 2026 10:21

Copy link
Copy Markdown
Collaborator

Re-review at head 3e4aa1f2f5225d287dfa54496081a0babdcee536 (draft; base 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The branch was rebased and squashed into one commit, so there is no direct 8f3aebd2e1359d11d8bcdd034f5dacedf9a1f12d..3e4aa1f2f5225d287dfa54496081a0babdcee536 range. I compared the old PR diff (663f3b32...8f3aebd2) with the new one (14fa1f57...3e4aa1f2) file by file. Not approving yet.

What changed since 8f3aebd2

  • 24 new files, 0 removed. The new files add two more NPU scenarios: src/inferrsi/data/engineering_scenarios/qwen21-denoise-npu/ (+ docs/qwen21-denoise-benchmark.md, tests/test_qwen21_task.py) and src/inferrsi/data/engineering_scenarios/qwen3-tts-npu/ (+ src/inferrsi/harness/benchmarks/tts.py, src/inferrsi/harness/scenarios/tts.py, docs/tts-benchmark.md, tests/test_tts_benchmark.py, tests/test_tts_standalone.py).
  • Five existing files changed relative to the old diff: pyproject.toml (adds data/engineering_scenarios/**/*.jsonl and keeps main's data/dashboard/*.html), tests/check_installed.py (TTS resources), tests/test_evidence_inventory.py (bundle count 22 to 23), .github/workflows/ci-ready.yml (whitespace only) and docs/engineering-benchmarks.md.

Blocking / open

  1. CI is red at this head. Both full-check (3.10) and full-check (3.11) fail: 2 failed, 3758 passed, 21 skipped (3.11 job). The tail of the log I could read is a long packaged-file listing, so I couldn't identify the two failing tests from it. Please name them and fix or explain them. My guess, which I haven't verified: one is in the installed-resource or evidence-inventory checks touched above. The hard-coded len(result["bundles"]) == 23 in tests/test_evidence_inventory.py also depends on how many bundles main has.
  2. Non-string phase / failure_kind is still unguarded (src/inferrsi/harness/scenarios/moe.py L196-197). r.get("phase", "").startswith(...) / r.get("failure_kind", "").startswith(...) still raise AttributeError for "phase": null, while the loop at L188-189 already uses isinstance(..., str). This is unchanged from my 2026-11-06 review. Please reuse the guard and add a phase=None case.
  3. The paired NPU trial timeout is still not bound (tools/npu_benchmark_validate.py L101 vs L120-123). --timeout-seconds reaches only run_action(). The aa / reference comparisons still go through task.runspec(...) + run_experiment(...) without it, and the task: connect engineering tasks to existing Agent execution and evaluation #337 total pilot envelope isn't enforced. Also unchanged.
  4. The scope grew again without a description update. The title and body cover the shared evaluation contract and the EP=2 MoE task. The two new real-model scenarios (Qwen-Image 2.1 denoise and Qwen3-TTS 1.7B CustomVoice with a loopback service) aren't mentioned, and neither are their validation status or the tests that cover them. Combined with Dong1017's structural question about parallel engineering_benchmarks/ vs engineering_scenarios/ libraries and entry styles, this is now three distributed scenarios plus the TaskPackage path in one PR. Could the TTS and Qwen-Image scenarios go in follow-up PRs, or could the body at least document each scenario's contract, which entry point runs it, and what was actually executed?
  5. Stale links in the PR body. The "How to use and review" links still point at Bounty-hunter/InferRSI/blob/8f3aebd2.../. Please update them to this head (or to repo-relative paths) so reviewers read the current docs.

Questions on the new scenarios (static reading only)

  • qwen3-tts-npu/sources.json says official qwen-tts 0.1.1 components run the real 1.7B checkpoint. Are any upstream source files vendored into inference.py / service.py, or is all of that bundled code independently written? qwen21-denoise-npu/NOTICE.md makes this explicit for the denoise task; please state the same for TTS.
  • qwen3-tts-npu/model-assets.json: are the checkpoint/tokenizer identities pinned by revision and hash, and does the grader re-check them after execution, as the MoE path does for its frozen identities?

Static review of the diff only; I did not run any NPU tooling or the new tests.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 3e4aa1f to 4afcbfb Compare November 10, 2026 11:45
@Bounty-hunter Bounty-hunter changed the title feat: add shared engineering evaluation and dual-NPU MoE task feat: add MoE, Qwen-Image and Qwen3-TTS optimization tasks Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Re-review at head 4afcbfbfc182cf23092c6ae15927906b75633428 (draft; base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The single commit was amended, so there is no direct 3e4aa1f2f5225d287dfa54496081a0babdcee536..4afcbfbfc182cf23092c6ae15927906b75633428 range. I compared the previous PR diff (14fa1f57...3e4aa1f2, 108 files) with the new one (14fa1f57...4afcbfbf, 46 files) file by file. Not approving yet.

What changed since 3e4aa1f2

  • Scope cut: the evidence/moe-agent-comparison-20261104/ bundle, the RMSNorm and Softmax packages, harness/benchmarks/{contract,worker,consumers,numpy_task,npu_task,skill_verifier}.py, skill_eval_benchmark.py, tools/{npu_benchmark_validate,engineering_benchmark_validate}.py, the SkillEval changes, tests/test_evidence_inventory.py and the .github/workflows/ci-ready.yml change are all gone.
  • The three NPU packages moved from data/engineering_scenarios/ to data/engineering_benchmarks/. A new harness/benchmarks/catalog.py is the one place for package discovery, and inferrsi benchmarks list|show is now read-only discovery. moe.py and tts.py resolve their resources through it, and pyproject.toml has one engineering_benchmarks/**/*.py|*.jsonl package-data entry.
  • tests/test_engineering_benchmarks.py was rewritten for the new catalog. It adds a cwd-shadowing test and a ../qwen3-tts-npu traversal rejection test.

Resolved or moot

  • Paired NPU trial timeout (item 3 of 6765174530): tools/npu_benchmark_validate.py is no longer in this PR, so the issue no longer applies here. If it comes back in a follow-up, the original point still holds.
  • Evidence-inventory count (len(result["bundles"]) == 23): no longer touched.
  • Dong1017's structural question (comment): there is now a single task library and a single discovery path. Execution entries stay task-specific (python -m tools.moe_benchmark, the TTS prepare/serve/collect/assess flow), and the docs say so. That looks like a reasonable answer, but please confirm with Dong1017 in that thread, and say whether their earlier CHANGES_REQUESTED points (cwd task shadowing, cleanup) are cleared at this head.

Blocking / open

  1. CI is still red at this head. full-check (3.10) and full-check (3.11) both fail (3.11 job). The annotations only say Process completed with exit code 1, and I can't read the job log, so I don't know which tests fail. installed-package, pr-references and declarations are green. The PR body says 16 failures in the wider regression run reproduce on unchanged main, but the base 14fa1f57 has no full-check run to compare against. Please name the failing tests on this head, and either fix them or show they fail the same way on main.
  2. Non-string phase / failure_kind is still unguarded (src/inferrsi/harness/scenarios/moe.py L197-198). This amend only changed the resource import (L21, L28-29). r.get("phase", "").startswith(...) and r.get("failure_kind", "").startswith(...) still raise AttributeError for "phase": null, while L189-190 already use an isinstance(..., str) guard. Please reuse that guard and add a phase=None case. This has been open since 2026-11-05.
  3. Still a draft and mergeable_state=unstable. Please mark it ready once 1 and 2 are settled so the Ready checks run.

Static review of the interdiff and the cited sources only. I didn't run the tests or any NPU tooling.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 4afcbfb to f2c3e7a Compare November 10, 2026 12:21

Copy link
Copy Markdown
Collaborator

Re-review at head f2c3e7a00f1cc4eab2c101e4e76ab07b9eb39618 (draft; base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The single commit was amended again, so I compared the previous PR diff (14fa1f57...4afcbfbfc182cf23092c6ae15927906b75633428) with the new one (14fa1f57...f2c3e7a0, 48 files) file by file. Not approving yet.

What changed since 4afcbfbf

  • The task-specific Python moved into the packages: harness/scenarios/{moe,moe_grader,_moe_processes,tts}.py and harness/benchmarks/tts.py are gone. The code now lives in engineering_benchmarks/moe-forward-npu/{benchmark,grader,processes}.py and engineering_benchmarks/qwen3-tts-npu/{benchmark,evaluation}.py.
  • inferrsi benchmarks run <package> ... is new (harness/benchmarks/cli.py). It resolves the package's benchmark.py and runs it with sys.executable, forwarding the remaining arguments and the exit code. The docs and tests/check_installed.py were updated to match. The new tests cover --help for all three packages and argument/exit-status passthrough.
  • tests/engineering_task_support.py loads the package modules by file path for the tests.

This split looks cleaner to me. Each package now owns its entry and its assessment, and the CLI only does discovery and launch.

Blocking / open

  1. CI is still red at this head. full-check (3.10) and full-check (3.11) both fail (3.10 job, 3.11 job). installed-package, pr-references and declarations are green. As before, the annotations only say Process completed with exit code 1 and I can't read the log. Please name the failing tests on this head, and either fix them or show they fail the same way on main.
  2. The unguarded phase / failure_kind check moved but wasn't fixed. In src/inferrsi/data/engineering_benchmarks/moe-forward-npu/benchmark.py, L197-199 guard with isinstance(..., str). L205-206 still call r.get("phase", "").startswith("candidate_") and r.get("failure_kind", "").startswith(...) on rank records. A record with "phase": null or a non-string value would raise AttributeError there instead of being adjudicated. Could you reuse the same guard?
  3. Question about the launcher: cli.py calls str(task_resources(args.task).joinpath("benchmark.py")) and passes it to a subprocess. That works for a normal directory install. Is a zipped or other non-filesystem install of inferrsi out of scope? If it isn't, importlib.resources.as_file would be safer. If it is, a short note in the docs would be enough.

Dong1017's earlier CHANGES_REQUESTED still needs their confirmation in the existing thread.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from f2c3e7a to 803d04b Compare November 10, 2026 12:32

Copy link
Copy Markdown
Collaborator

Re-review at head 803d04bb51ce545ad4f296cf9d5fb2816b26d675 (draft; base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The commit was amended again. I compared the PR diff at f2c3e7a00f1cc4eab2c101e4e76ab07b9eb39618 with the one at 803d04bb, which now has 50 files. Only four files changed. Not approving yet.

What changed since f2c3e7a0

  • src/inferrsi/harness/benchmarks/cli.py: run now builds the child environment itself. It puts the directory containing the installed inferrsi package first on PYTHONPATH, keeps the inherited PYTHONPATH after it, and passes PYTHONDONTWRITEBYTECODE through.
  • tools/plugin_bundle.py: the runtime bundle now includes data/engineering_benchmarks/**/*.jsonl.
  • tests/test_codex_plugin.py adds two isolated-runtime tests. One checks that a shadowing inferrsi.py on PYTHONPATH doesn't take over the child. The other runs TTS prepare against the bundled workload. tests/test_engineering_benchmarks.py was updated to match.
  • CI is green now. full-check (3.10/3.11), installed-package (3.10/3.11), pr-references and declarations all pass, so item 1 of my previous comment is resolved.

Still open

  1. The unguarded phase / failure_kind check is unchanged. src/inferrsi/data/engineering_benchmarks/moe-forward-npu/benchmark.py L205-206 still does r.get("phase", "").startswith("candidate_") and r.get("failure_kind", "").startswith(...). A rank record with "phase": null or another non-string value raises AttributeError there, even though L197-199 just above guard the same fields with isinstance(..., str).
  2. Question about the launcher's PYTHONPATH order: the parent directory of inferrsi is now prepended ahead of the caller's PYTHONPATH. In a normal install that directory is the whole site-packages, so every installed package now takes precedence over anything the caller deliberately put on PYTHONPATH, for example a locally patched torch_npu or vLLM build. Is that intended? If you only need inferrsi itself to win, one option is to make the child resolve inferrsi explicitly, without reordering the rest of the path. If you keep the current behaviour, please document it in docs/engineering-benchmarks.md.
  3. My earlier question about non-filesystem installs is still unanswered. Path(str(files("inferrsi"))) and str(task_resources(...).joinpath("benchmark.py")) both assume a directory install. Please say whether zip installs are out of scope.

Dong1017's earlier CHANGES_REQUESTED still needs their confirmation in the existing thread.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 803d04b to c49e4b6 Compare November 10, 2026 12:56

Copy link
Copy Markdown
Collaborator

Re-review at head c49e4b680fc3a59b1c8566ea81e4814a4ad38f08 (draft; base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The commit was amended again, so there's no direct 803d04bb51ce545ad4f296cf9d5fb2816b26d675..c49e4b680fc3a59b1c8566ea81e4814a4ad38f08 range. I compared the PR diff at 803d04bb with the one at c49e4b68 (14fa1f57...c49e4b68, 50 files). Not approving yet.

What changed since 803d04bb

  • The discovery and launch code moved from src/inferrsi/harness/benchmarks/ to a single module, src/inferrsi/benchmark_operations.py. The benchmarks list|show|run arguments are now in src/inferrsi/arguments.py and are dispatched in src/inferrsi/cli.py L119-128.
  • Packages are now listed explicitly in src/inferrsi/data/engineering_benchmarks/index.json (schema_version 1). builtin_tasks() validates the schema version, the list type, the kebab-case names and duplicates. task_resources() rejects unregistered or missing packages, so the earlier path-traversal concern is covered by the name regex.
  • tests/test_benchmark_operations.py is new. It covers a resource-only task with argument and exit-code passthrough (0/1/2), invalid registries, unsafe names (../escape, a/b, /absolute, None, ...) and a missing benchmark.py. The isolated-runtime tests moved to tests/test_engineering_benchmark_plugins.py.
  • CI at this head: installed-package (3.10/3.11), pr-references and declarations pass. full-check (3.10/3.11) was still running when I looked, so I can't confirm the full suite yet.

The registry and validation look good to me.

Still open

  1. The unguarded phase / failure_kind check is still there. src/inferrsi/data/engineering_benchmarks/moe-forward-npu/benchmark.py L205-206 still calls r.get("phase", "").startswith("candidate_") and r.get("failure_kind", "").startswith("candidate_"). A rank record with "phase": null or another non-string value raises AttributeError there, while L197-199 just above guard the same fields with isinstance(..., str). Please reuse that guard and add a phase=None test case.
  2. PYTHONPATH order in run_task() (src/inferrsi/benchmark_operations.py L58-61). The parent directory of inferrsi is still put ahead of the caller's PYTHONPATH. In a normal install that directory is all of site-packages, so installed packages win over anything the caller deliberately put on PYTHONPATH, for example a locally patched torch_npu or vLLM build. Is that intended? If yes, please document it in docs/engineering-benchmarks.md. Right now I can't find it mentioned in the docs.
  3. Non-filesystem installs: Path(str(files("inferrsi"))) (L58) and str(entry) (L64) still assume a directory install. Please say whether zip or other non-directory installs are out of scope.
  4. Please make sure full-check (3.10/3.11) is green on this head.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from c49e4b6 to 4a11090 Compare November 10, 2026 13:16

Copy link
Copy Markdown
Collaborator

Re-review at head 4a11090fe481813f80c1d9ed0d4f3363035df8c3 (draft; base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The commit was amended again, so there's no direct c49e4b680fc3a59b1c8566ea81e4814a4ad38f08..4a11090fe481813f80c1d9ed0d4f3363035df8c3 range. I compared the PR diff at c49e4b68 with the one at 4a11090f file by file. Not approving yet.

What changed since c49e4b68

  • The three task packages moved from src/inferrsi/data/engineering_benchmarks/ to src/inferrsi/benchmark/tasks/. The registry moved into the new inferrsi.benchmark.registry. pyproject.toml declares inferrsi.benchmark package data for tasks/**, and tools/plugin_bundle.py and tests/test_codex_plugin.py were updated to match. Every moved file is byte-identical to the previous head except moe-forward-npu/benchmark.py.
  • moe-forward-npu/benchmark.py no longer imports inferrsi.harness.scenarios.external itself. evaluate() / main() now take execute_trial as an argument, and benchmark_operations.py injects it. run_task() now starts python <benchmark_operations.py> <entry> ..., and _run_entry() runs the entry with runpy.run_path(..., init_globals={"execute_trial": ...}).
  • tests/test_target_module_import_gate.py treats cli.py and benchmark_operations.py as application entries and adds cases for benchmark/ importing harness. docs/module-layout.md documents this.
  • CI is green at this head: full-check (3.10/3.11), installed-package (3.10/3.11), pr-references and declarations all pass.

Moving the harness dependency out of the task, so the Benchmark core no longer imports Harness, looks right to me.

Still open

  1. The unguarded phase / failure_kind check is still there. src/inferrsi/benchmark/tasks/moe-forward-npu/benchmark.py L204-205 still calls r.get("phase", "").startswith("candidate_") and r.get("failure_kind", "").startswith("candidate_"). A rank record with "phase": null or another non-string value raises AttributeError there, while L197-198 just above guard the same fields with isinstance(..., str). I've raised this in each review since 2026-11-06. Please reuse that guard and add a phase=None test case, or explain why it can't happen.
  2. PYTHONPATH order (src/inferrsi/benchmark_operations.py L22-25) and non-directory installs (Path(str(files("inferrsi"))) at L22): my questions from the last two reviews are still unanswered. Is putting all of site-packages ahead of the caller's PYTHONPATH intended, and are zip installs out of scope? Please answer here or document it in docs/engineering-benchmarks.md.
  3. New question about launching benchmark_operations.py as a script: running it by file path makes its directory (the installed inferrsi/ package directory) sys.path[0] in the child. Every inferrsi submodule then also becomes importable under a bare top-level name (benchmark, harness, model, catalog, evaluation, ...). That can shadow a third-party package with the same name that a task or its candidate imports. _run_entry() then puts the task directory in front, so a task-local benchmark.py also wins over the inferrsi/benchmark/ package. I can see this is how you avoid cwd shadowing on Python 3.10, which has no -P. Is the extra path entry intended? If not, one option is to remove sys.path[0] in _run_entry() before inserting the task directory.

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch 2 times, most recently from b700ae0 to 21b0a4f Compare November 10, 2026 14:07

Copy link
Copy Markdown
Collaborator

Re-review at head 21b0a4f0dfa8d514c38664ea119c52bf97825deb (draft). The branch was rebased onto base 4b3afa55f278ca314e07d5f8acbd0a18f3fa72bf and squashed, so there's no direct 4a11090fe481813f80c1d9ed0d4f3363035df8c3..21b0a4f0dfa8d514c38664ea119c52bf97825deb range. I compared the PR diff at 4a11090f (14fa1f57...4a11090f, 54 files) with the one at 21b0a4f0 (4b3afa55...21b0a4f0, 68 files) file by file. Not approving yet.

What changed since 4a11090f

  • New current-Agent optimization session: inferrsi benchmarks session start|status|knowledge|round|final|recover (src/inferrsi/arguments.py, cli.py, benchmark_operations.py L40-127), the persisted round controller src/inferrsi/harness/optimization.py, frozen-task preparation in src/inferrsi/benchmark/optimization.py, and a task-owned protocol benchmark/tasks/qwen21-denoise-npu/optimization.py. New docs docs/optimization-benchmarks.md, plus updates to AGENTS.md, README.md and both plugin SKILL.md files.
  • New tests tests/test_optimization_session.py and tests/test_qwen_optimization_protocol.py (round budget, final-before-rounds, frozen drift, OS lock, knowledge binding, A/A noise).
  • CI is green at this head: full-check (3.10/3.11), installed-package (3.10/3.11), pr-references and declarations all pass.

The plan/state digests, per-round retained hashes and the pending-attempt guard are a solid design.

Still open from earlier reviews

  1. Unguarded phase / failure_kind check, unchanged. src/inferrsi/benchmark/tasks/moe-forward-npu/benchmark.py L204-205 still calls r.get("phase", "").startswith(...) / r.get("failure_kind", "").startswith(...), while L197-198 guard the same fields with isinstance(..., str). A "phase": null rank record raises AttributeError. Please reuse the guard and add a phase=None test, or explain why it can't happen.
  2. PYTHONPATH order and non-directory installs. The new comment at benchmark_operations.py L19-20 answers that putting the bundle's parent first is intentional, thanks. Please also note it in docs/engineering-benchmarks.md, and say whether zip/non-directory installs are out of scope (Path(str(files("inferrsi"))) is now used at L21 and in _runtime_identity() L63).
  3. sys.path[0] when launching benchmark_operations.py by path (_run_entry() L130-135, unchanged): the installed inferrsi/ directory still becomes importable as top-level names (benchmark, harness, ...). Is that intended?

New in this push
4. Extra files in frozen/ are not detected. _load() (harness/optimization.py L69-72) only re-hashes the files recorded in frozen_files. A file added later under <session>/frozen/ passes the check, and _run_entry() puts that directory at sys.path[0], so e.g. frozen/numpy.py would shadow imports in the evaluator. Could _load() also reject files not listed in frozen_files?
5. Stuck session if execute raises. evaluate_round() persists pending (L255-256) before execute(...) (L257). If execute_trial raises before writing execution/execution.json, recover() (L268-270) only ever raises "Execution record unavailable", and _active() rejects every other action. What is the documented way out in that case? An explicit "abandon pending attempt" action, or settling it as infrastructure_failure, would make the state machine terminal.
6. Infrastructure failure is permanent. _settle() L218-219 sets blocked on any infrastructure_failure, including assessment exceptions caught at L193-195 (e.g. a transient NPU/driver error, or deadline - now reaching 0 in _session_execute L49). There's no resume path from blocked. Is it intended that one transient failure ends the whole session? If so, please state it in docs/optimization-benchmarks.md (currently L65-66 only says it "blocks the session").
7. Docs vs. code for a failed final. docs/optimization-benchmarks.md says "A failed final leaves the session incomplete", but _settle() L216-217 marks it blocked, and final can't be retried. Please align the wording or allow a retry.

@Bounty-hunter Bounty-hunter changed the title feat: add MoE, Qwen-Image and Qwen3-TTS optimization tasks feat: add optimization tasks and current-Agent benchmark sessions Nov 10, 2026
@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 21b0a4f to 8baed1a Compare November 11, 2026 02:49

Copy link
Copy Markdown
Collaborator

Re-review at head 8baed1a5aba322492c4b2bfe241d88b638a81d51 (draft; merge base 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The single commit was amended again, so there's no direct 21b0a4f0dfa8d514c38664ea119c52bf97825deb..8baed1a5aba322492c4b2bfe241d88b638a81d51 range. I compared the PR diff at 21b0a4f0 (68 files) with the one at 8baed1a5 (71 files) file by file. Not approving yet.

What changed since 21b0a4f0

  • New native-host handoff: src/inferrsi/harness/agent_sessions.py (prepare/dispatch/bind/record/status), the inferrsi agents ... CLI (arguments.py, cli.py), benchmarks session handoff (benchmark_operations.py L110-148, plus harness/agent_sessions.py added to _runtime_identity()), and optimization.prepare_agent_handoff() (harness/optimization.py L117-130), which links one job into state.json and summary.json.
  • New docs/native-agent-sessions.md and tests/test_agent_sessions.py, plus a handoff test in tests/test_optimization_session.py and doc updates in AGENTS.md, docs/architecture.md, docs/module-layout.md, docs/operations.md, docs/optimization-benchmarks.md and both plugin SKILL.md files.
  • Every other file is byte-identical to 21b0a4f0, including moe-forward-npu/benchmark.py and the pre-existing parts of harness/optimization.py.
  • CI at this head: installed-package (3.10/3.11), pr-references and declarations pass. full-check (3.10/3.11) was still running when I looked.

The single-dispatch reservation, idempotent bind, the definite not_created path and keeping task_acceptance: not_assessed separate from native completion look careful.

Still open from my previous review (unchanged code)

  1. Unguarded phase / failure_kind: src/inferrsi/benchmark/tasks/moe-forward-npu/benchmark.py L204-205 vs the isinstance guard at L197-198. A "phase": null rank record raises AttributeError.
  2. Zip/non-directory installs: Path(str(files("inferrsi"))) at benchmark_operations.py L21 and L63. Is this out of scope? Please also note the PYTHONPATH order in docs/engineering-benchmarks.md.
  3. sys.path[0] when launching benchmark_operations.py by path (_run_entry() L169-173): the installed inferrsi/ directory is still importable under top-level names.
  4. Extra files in frozen/ are not detected (harness/optimization.py _load() L64-72).
  5. Stuck session if execute raises (L273-275 persist pending before execute; recover() L286-288 only raises "Execution record unavailable").
  6. Any infrastructure_failure permanently blocks the session (_settle() L235-237).
  7. Docs vs. code for a failed final: docs/optimization-benchmarks.md still says "A failed final leaves the session incomplete", but _settle() marks it blocked.

New in this push
8. session final doesn't look at the linked native job. evaluate_round(..., final=True) (L245-276) only checks the round count. It can run while the bound native session is still running, or when the job was never dispatched. summary.json (L181) then records only path/job_id/request_digest, not the bound native session ID, its last observed state, or last_observed_usage. docs/native-agent-sessions.md L136-138 says the initiator runs final after recording completion and that the native record supplies execution state and costs. As it stands, the summary can't show that the rounds came from the bound child or that the child had finished. Should final (through an injected callback, to keep optimization free of agent_sessions) require a terminal job state and copy the native identity, state and usage into the summary? Otherwise please document that this ordering is the initiator's responsibility and isn't checked.
9. Repeated terminal observations can still overwrite the record. record() L214 only rejects a change of terminal state. A second completed observation is accepted, appends more artifacts, and resets state["usage"] to that observation's value (L242, which can be None). Is that intended? If not, reject any record() after a terminal state, or at least don't let it replace the completed usage or add deliverables. A test next to test_native_completion_is_not_acceptance_and_deliverable_is_snapshotted (tests/test_agent_sessions.py L111-128) would pin this down.
10. Job creation isn't atomic with the session link. prepare_agent_handoff() calls prepare() (which creates the job directory) at L124, then writes the session state.json at L129. If that write fails, the session has no agent_job, so a second session handoff with another --job succeeds, and the first job is still dispatchable. This is minor, but a re-check on retry (or writing the link first) would close it.
11. The PR body doesn't cover the new scope. The title and body describe the optimization tasks and current-Agent sessions. The inferrsi agents prepare/dispatch/bind/record/status commands and benchmarks session handoff aren't mentioned, and neither is what was actually exercised (only synthetic host receipts in tests, as far as I can see). Please add them to the body, or consider moving the native handoff to a follow-up PR given how large this one already is.

Static review of the diff and surrounding code; I didn't run the tests or any host/NPU tooling.

Reviewed commit range: 21b0a4f0dfa8d514c38664ea119c52bf97825deb … 8baed1a5aba322492c4b2bfe241d88b638a81d51 (compared as PR diffs from 14fa1f578655bbdcd101b8c4235299fc3d8360d3).

@Bounty-hunter Bounty-hunter changed the title feat: add optimization tasks and current-Agent benchmark sessions feat: add optimization tasks and native Agent session handoffs Nov 11, 2026
@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 8baed1a to 0b7883e Compare November 11, 2026 04:39
@Bounty-hunter Bounty-hunter changed the title feat: add optimization tasks and native Agent session handoffs feat: share RSI optimization management across project and benchmark tasks Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Re-review at head 0b7883e89f180c58a5055b1fe0ee02d05f0608e7 (draft, merge base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The single commit was amended again, so there's no direct commit range. I diffed the tree at 8baed1a5aba322492c4b2bfe241d88b638a81d51 against the tree at 0b7883e89f180c58a5055b1fe0ee02d05f0608e7 file by file: 20 modified files plus 5 new ones (benchmark/project.py, harness/candidates.py, harness/optimization_chart.py, tests/test_project_optimization.py, docs/optimization-workflow-unification.md). Not approving yet.

What changed since 8baed1a5

  • Ordinary projects now run on the same controller (campaign start/knowledge/round/status/final/recover) through benchmark/project.py and _project_execute() (benchmark_operations.py L68-110). The baseline and candidates are multi-file snapshots (candidates.retain/identity). Selection now supports both minimize and maximize. There are exact/up_to round modes, a final_reserve_seconds budget and stop_reason.
  • _load() now compares the full frozen/ file set and rejects symlinks. That fixes my earlier item 4 (extra frozen files). It also hashes observation.json. Managed campaigns get a campaign.json with managed_optimization, which blocks manual record/decide/capture-context. The dashboard has a _managed_dashboard() projection.
  • The PR body now covers the native handoff and says the initiator runs final after the child finishes. I'm treating my earlier item 8 as documented and item 11 as addressed.

New blocking issue

  1. A project command that writes any file into its working directory permanently breaks the session. _project_execute() runs every step with cwd=source (L94). For baseline steps, source is root / "frozen/baseline". Only bytecode is suppressed (PYTHONDONTWRITEBYTECODE). Any other write in the cwd, such as a log, .pytest_cache, a build output or a profiler dump, changes frozen/baseline. The post-execution _load(root) in _settle() (harness/optimization.py L245) then raises Frozen task resources changed (content or file set) before pending is cleared. From then on, round, status and recover all fail with the same error, so the campaign can't be read, retried or recovered. I reproduced this locally at this head with the project fixture from tests/test_project_optimization.py, adding one line to measure.py: Path('scratch.log').write_text('x'). The first campaign round exits 2, campaign status and campaign recover exit 2, state.json keeps pending != null, and frozen/baseline/scratch.log exists. The per-step source_checks would have caught this as failed, but _load() runs before the assessment can record it. Please either run each step in a fresh scratch working directory (for example directory / "execution" / step_id / "cwd") and pass {candidate}/{baseline} only as paths, or execute against a disposable copy of the baseline. Separately, please make sure a drift detected after execution settles the attempt as infrastructure_failure/blocked, not as an exception that leaves pending behind. A regression test with a command that writes into its cwd would pin this down.

Smaller / questions on the new code
2. The baseline-score check can raise with pending still set. At optimization.py L268-271, a completed first-round assessment without a finite baseline_score raises inside _settle(), again before pending is cleared. project.assess always provides it today, but any other adapter that uses initial_score: None would hit this. Please classify it as an infrastructure_failure observation.
3. Selection compares absolute medians across rounds. improved (L273-275) compares this round's candidate median against best.score, which comes from a different round. That earlier score is either the previous winner's candidate median or the first round's baseline median. Eligibility is gated against the same-round paired baseline, but the ranking between rounds isn't. With machine drift between rounds, a noise-level difference can move the selection. Is that intended, given that final re-measures independently? If so, please say so in docs/optimization-workflow-unification.md. Otherwise, compare on the paired improvement_pct.
4. optimization_speedup (_summary): final["assessment"].get("speedup") or (...) treats a legitimate 0.0 as missing. Use is not None. Minor.
5. Docs vs. up_to mode. docs/optimization-benchmarks.md L90-91 still says the controller "rejects finalization before the planned rounds are complete". That is only true for round_mode=exact now.

Still open from my previous review (code unchanged in this push)

  • (1) moe-forward-npu/benchmark.py L204-205: r.get("phase", "").startswith(...) is still unguarded against "phase": null.
  • (2) Path(str(files("inferrsi"))) in benchmark_operations.py L21/L116 (zip installs).
  • (3) _run_entry() L262-267 still inserts the entry's directory at sys.path[0].
  • (5) pending is persisted before execute, so an exception in execute still leaves a session that recover() can only reject ("Execution record unavailable").
  • (6) Any infrastructure_failure still sets blocked permanently (L288-289).
  • (7) The "failed final leaves the session incomplete" wording in docs/optimization-benchmarks.md L93-94 vs. blocked in code.
  • (9)/(10) harness/agent_sessions.py is byte-identical to 8baed1a5, so the repeated-terminal-observation and job-link-atomicity questions still stand.

Static review of the tree diff plus the surrounding code. I ran only the cwd-write reproduction above (Linux, Python 3.13, against the PR's own fixture). I did not run the full suite or any NPU task.

Reviewed: 8baed1a5aba322492c4b2bfe241d88b638a81d51 → 0b7883e89f180c58a5055b1fe0ee02d05f0608e7 (tree diff, same merge base 14fa1f578655bbdcd101b8c4235299fc3d8360d3).

@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 0b7883e to 88bef30 Compare November 11, 2026 05:26

Copy link
Copy Markdown
Collaborator

Re-review at head 88bef305e1c323a10662e5de333df34983883ab3 (draft, merge base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The single commit was amended again. I diffed the tree at 0b7883e89f180c58a5055b1fe0ee02d05f0608e7 against 88bef305e1c323a10662e5de333df34983883ab3. Only two docs files changed: docs/native-agent-sessions.md (+14/-1) and docs/optimization-workflow-unification.md (+22/-8). All code and tests are byte-identical. Not approving yet.

This delta (docs only)

  • Both sequence diagrams now show the existing CLI adapter (cli.py → benchmark_operations.session_command()) as its own participant. They also spell out what happens inside a single start call: the task or protocol is copied into frozen/, the baseline is retained, and plan.json/state.json are initialized. start doesn't measure anything.
  • I checked this against the code at this head and it matches. For project tasks, session_command() calls benchmark.project.prepare (L147-159), then candidates.retain(repo, frozen/baseline) (L160), then optimization.initialize() (L185). For packaged tasks, it calls benchmark.optimization.prepare and then copies frozen/baseline.py to work/candidate.py (L170-172). Neither path runs execute. The clarification looks good to me.

Still open (code unchanged since my previous review)

  1. Blocking: a project command that writes into its cwd (cwd=source = frozen/baseline in _project_execute(), benchmark_operations.py L94) changes the frozen file set. _load() in _settle() (harness/optimization.py L245) then raises with pending still set, so round/status/recover all fail. Please run each step in a scratch cwd or against a disposable baseline copy. Please also settle drift detected after execution as infrastructure_failure/blocked instead of raising, and add a regression test.
  2. optimization.py L268-271: a missing finite baseline_score raises inside _settle() with pending set. Please classify it as an infrastructure_failure observation.
  3. Cross-round selection compares absolute medians (L273-275). Please either document that this is intended or compare on the paired improvement_pct.
  4. optimization_speedup in _summary uses or, which treats 0.0 as missing. Please use is not None.
  5. docs/optimization-benchmarks.md L90-91 says finalization is rejected before the planned rounds are complete. That only holds for round_mode=exact.
  • Earlier items, also unchanged: the unguarded phase in moe-forward-npu/benchmark.py L204-205; Path(str(files("inferrsi"))) for zip installs; _run_entry() inserting at sys.path[0]; pending persisted before execute; any infrastructure_failure blocking the session permanently; the "failed final leaves the session incomplete" docs wording vs blocked; the repeated terminal observation and job-link atomicity in harness/agent_sessions.py.

This is a static review of the tree diff, checked against the surrounding code. I didn't run tests this time, since the code is unchanged.

Reviewed: 0b7883e89f180c58a5055b1fe0ee02d05f0608e7 → 88bef305e1c323a10662e5de333df34983883ab3 (tree diff, same merge base 14fa1f578655bbdcd101b8c4235299fc3d8360d3).

Package MoE, Qwen-Image denoising and real-model Qwen3-TTS tasks with
task-owned measurement and assessment. Share Harness budget, candidates,
feedback, selection and final retesting between packaged tasks and ordinary
multi-file projects with explicit caller-provided acceptance conditions.

Support optional fresh native-host conversations for benchmark tasks while
ordinary projects default to the current Agent. Retain handoff identity,
observed usage and deliverables separately from task acceptance.

Expose shared records and final outcomes in the dashboard, and document
component boundaries, explicit conditions and both session paths.

Agent-assisted-by: Codex (implementation, source research, documentation, review and validation)
Signed-off-by: dengyunyang <584797741@qq.com>
@Bounty-hunter
Bounty-hunter force-pushed the codex/issue252-engineering-benchmarks branch from 88bef30 to 3cbb74f Compare November 11, 2026 07:28

Copy link
Copy Markdown
Collaborator

Re-review at head 3cbb74f5f87ba4bbfe54a972a9e9e9b86e5b0ab3 (draft, merge base still 14fa1f578655bbdcd101b8c4235299fc3d8360d3). The single commit was amended again, so I diffed the tree at 88bef305e1c323a10662e5de333df34983883ab3 against 3cbb74f5f87ba4bbfe54a972a9e9e9b86e5b0ab3: 17 files, +348/-268. Not approving yet.

What changed since 88bef305

  • The benchmark-specific handoff is gone: benchmarks session handoff (arguments.py, benchmark_operations.py), optimization.prepare_agent_handoff(), and agent_job in status()/_summary(). The flow is now the generic agents prepare/dispatch/bind/record, and the child conversation runs start … final itself. tests/test_optimization_session.py now has test_generic_job_precedes_child_start_and_collects_child_final instead of the old handoff test.
  • The OS lock moved to infra/artifacts.file_lock(). harness/agent_sessions.py no longer imports _locked from harness/optimization.py. The lock body is unchanged, and the decoupling looks good.
  • qwen21-denoise-npu/benchmark.py adds OutputValidationError. Only explicit output/mutation/numerical checks during a candidate_* phase now produce candidate_failure. Every other exception becomes infrastructure_failure/INCONCLUSIVE, and tests/test_qwen21_task.py covers this.
  • Docs (AGENTS.md, docs/native-agent-sessions.md, docs/optimization-workflow-unification.md, both SKILL.md) and the PR body were updated to match.

My earlier items 8 (final not checking the linked job) and 10 (job-link atomicity) no longer apply now that prepare_agent_handoff() is removed.

New in this push

  1. A crashing candidate in qwen21 now blocks the whole session permanently. At qwen21-denoise-npu/benchmark.py L91-93, record["phase"] = "candidate_import" and round_consumed = True are set, then the candidate is loaded and run. With the new rule at L305-306, a SyntaxError/ImportError in candidate.py, or a RuntimeError/TypeError raised by the candidate's own compute, is classified as infrastructure_failure. optimization.assess passes that through (optimization.py L41-44), and _settle() in harness/optimization.py L244-245 then sets state = "blocked" for any infrastructure_failure. So one bad candidate submission ends the campaign, and recover() can't continue it. Before this push, the same candidate cost one round. I agree that NPU/driver errors shouldn't count as wrong outputs. But are candidate import/syntax errors, and exceptions whose traceback originates in candidate.py, really meant to be INCONCLUSIVE? If not, please classify at least candidate_import failures as candidate_failure, or add a third outcome (round consumed, session not blocked). Either way, please add a test for a candidate with a syntax error or one that raises inside compute, and state the intended behaviour in TASK.md/docs/optimization-benchmarks.md. This interacts with my earlier item 6 (any infrastructure_failure blocks permanently).
  2. Who now gives the independent final? In the old flow, the initiator ran session final itself. In the new flow, the child runs final and the parent only "inspects the child's summary/final" (docs/native-agent-sessions.md sequence diagram; the PR body says "不重复执行强制 final"). agents record keeps task_acceptance: not_assessed, and nothing on the parent side checks that the returned summary.json matches a retained state.json/observation.json under the declared session, or that final actually ran. Is it intended that the parent trusts the child's artifacts as returned? If so, please say explicitly in docs/native-agent-sessions.md that the parent's report is unverified child output. Otherwise, consider a read-only parent-side check, e.g. benchmarks session status plus hash comparison of the returned summary against the session directory.
  3. docs/native-agent-sessions.md L9 now says the fresh session "is the default for packaged optimization benchmarks", but benchmarks session start/round/final still work directly from the current conversation. Please clarify whether "default" is only a recommendation in the skill, or whether something enforces it.

Still open (code unchanged in this push)

  • Blocking: _project_execute() still runs steps with cwd=source, which is frozen/baseline for baseline steps (benchmark_operations.py L94-95). Any file written into the cwd changes the frozen set. _load(root) in _settle() (harness/optimization.py L201) then raises with pending still set, so round/status/recover all fail. Please use a scratch cwd or a disposable baseline copy, settle post-execution drift as infrastructure_failure/blocked instead of raising, and add a regression test.
  • harness/optimization.py L225-227: a missing finite baseline_score still raises inside _settle() with pending set.
  • L229-231: cross-round selection still compares absolute medians.
  • _summary L181: final["assessment"].get("speedup") or … still treats 0.0 as missing.
  • docs/optimization-benchmarks.md L96-99: "rejects finalization before the planned rounds are complete" (only true for exact) and "A failed final leaves the session incomplete" (the code sets blocked).
  • moe-forward-npu/benchmark.py L204-205: r.get("phase", "").startswith(...) is still unguarded against "phase": null.
  • Path(str(files("inferrsi"))) (benchmark_operations.py L21/L116) for zip installs; _run_entry() L225 still inserts at sys.path[0].
  • pending is still persisted before execute. Any infrastructure_failure still blocks permanently (see item 1).
  • harness/agent_sessions.py: a repeated terminal record() still overwrites usage and appends artifacts. Only the lock import changed.

This is a static review of the tree diff, checked against the surrounding code at this head. I didn't run the tests or any NPU/host tooling this time.

Reviewed: 88bef305e1c323a10662e5de333df34983883ab3 → 3cbb74f5f87ba4bbfe54a972a9e9e9b86e5b0ab3 (tree diff, same merge base 14fa1f578655bbdcd101b8c4235299fc3d8360d3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:harness Harness module: profile, A/B loop, quality gates, evidence reports kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants