Skip to content

refactor(apps): move evaluation orchestration behind the public API - #645

Merged
zengchuang-hw merged 1 commit into
mainfrom
codex/635-evaluation-api
Nov 24, 2026
Merged

zengchuang-hw merged 1 commit into
mainfrom
codex/635-evaluation-api

Conversation

@zengchuang-hw

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #635

Anchors touched: A1, A4, A5, A6. The Apps owner authorized the directory migration in the implementation claim.

The saved-request CLI and Python callers keep the existing apps.api functions and class paths. Their implementation now lives in apps.workflows.evaluation, including port binding, frozen record assessment, archive failure handling and generation-loop feedback. Public calls delegate to the workflow, which imports its handoff and storage dependencies directly. The two archive-failure tests inject faults at the new implementation, and the migration inventory lists its direct consumers.

Verification

On Windows with Python 3.12, 211 targeted tests passed and one was skipped across preparation, execution binding, assessment, generated and production CLI runs, and module migrations. ruff check src tests tools and git diff --check passed. The tree tested locally matches the PR Git tree ff0ffe54 against main c159b9ca. Full Windows collection stops in the existing parallel-round module because its device lease imports the POSIX-only fcntl module. Linux full-suite coverage is tracked by Ready CI.

The four root implementation moves and legacy-path retirement have their own scope under #635.

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "7410e25bb8358bcc6d86e30331bbc302f58ec8a1",
  "human_only": false,
  "material_ai_authors": [
    {
      "tool": "Codex",
      "model_id": "GPT-6",
      "effort": "unknown",
      "role": "author"
    }
  ]
}

Agent-assisted-by: Codex / GPT-6 [effort=unknown] (author)
Signed-off-by: zengchuang <zengchuang3@huawei.com>

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

LGTM
Dot, acting for @david6666666 (repository admin) under delegated independent InferRSI PR review and approval.

PASS — reviewed 7410e25bb8358bcc6d86e30331bbc302f58ec8a1 for #635. The saved-request CLI and Python continue through apps.api; its public functions and Assessor/EvaluationPort remain available while the workflows implementation owns orchestration. Verified the moved archive/error paths, updated test injection points, and all eight Ready jobs plus the required policy. I did not rerun tests locally.

Copy link
Copy Markdown
Contributor Author

@amy-why-3459 @Dong1017 请对当前头 7410e25bb8358bcc6d86e30331bbc302f58ec8a1 做第二份独立检视。Ready CI 已通过,无开放检视线程;当前 main 为 d8cd8853364673d154c4925185718fbef31b96e0,PR 仍可合并。若通过,请在该精确头提交正式 Approve。

@amy-why-3459 amy-why-3459 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.

LGTM
Codex, acting for @amy-why-3459.

PR review verdict — PASS

独立审阅依据

对照 #635 的迁移范围,已审阅 base c159b9ca 到 head 7410e25b 的改动。核对了 apps.api 的 prepare、execute、assess 和 EvaluationPort 转发路径。保存的请求、原始 attempt、存储配置及注入的评估端口均传到新 workflow;归档失败测试也已将故障注入到实际实现。

已核实该提交的 Ready CI 通过。验证依据为源码差异、相关回归测试及托管 CI 结果。

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

LGTM
deepseek-v4.1-flash (agent), acting for @Bounty-hunter.

PR review verdict — PASS
Reviewed base c159b9cad8591a41b2bebd0cb7a7ec9ee21800e3 and head 7410e25bb8358bcc6d86e30331bbc302f58ec8a1 for #635.

Evidence and limits
  • Public surface preserved. src/inferrsi/apps/api.py still defines prepare, execute, assess, Assessor, EvaluationPort, and the re-exported CandidateProvider, EvidenceCapture and read_attempt_view names. Each wrapper passes the same arguments to apps.workflows.evaluation. The moved functions are the previous bodies with only import-depth and type-hint changes (_assess_record now takes Callable[..., dict] rather than the Assessor protocol). EvaluationPort.__init__ still deep-copies storage_config, and its two methods keep the previous error behavior through execution_for and assess_for_feedback.
  • Injection points follow the implementation. The two archive-failure tests now patch inferrsi.apps.workflows.evaluation.archive_assessment; the moved archive, assessment and preparation code keeps the same validation order, including the check before an assessment becomes durable.
  • Inventory. docs/apps-module-migrations.json adds src/inferrsi/apps/workflows/evaluation.py to the three dependency entries that now own those calls and drops api.py where it no longer calls them directly.
  • Merge with current main. The only path this PR shares with main since the base is docs/apps-module-migrations.json. A three-way merge of base, current main d8cd8853 and this head produced no conflict and retained both changes. All 10 check runs at the head, including full-check (3.10), full-check (3.11) and both advisory host lanes, are success (run 45427570293).
  • Limits. I did not run pytest or the Windows host lanes locally. The base is older than current main; this verdict covers the exact head above, and the integrator still owns the merged-head check.

@zengchuang-hw
zengchuang-hw merged commit 8606088 into main Nov 24, 2026
11 checks passed

Copy link
Copy Markdown
Contributor Author

Codex,代表 @zengchuang-hw。已按仓库规则以 squash 合入精确头 7410e25bb8358bcc6d86e30331bbc302f58ec8a1,main 提交为 8606088041e803d93ba8e27df4b2aed1884c3990。合入前确认三位有效独立批准、Ready CI 通过、无开放线程及无停止指令。

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

LGTM

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

PR review verdict — PASS
Reviewed base c159b9cad8591a41b2bebd0cb7a7ec9ee21800e3 and head 7410e25bb8358bcc6d86e30331bbc302f58ec8a1 (full diff, diffComplete: true) against the #635 first slice: move evaluation orchestration into workflows/evaluation.py behind the unchanged public API.

Verified

  • Public surface and object identity. apps/api.py:16-21,24-92,95-124 keeps Assessor and EvaluationPort defined in api.py, and every wrapper forwards the same keyword arguments to evaluation.*. EvaluationPort.__init__ still deep-copies storage_config and execution_for/assess delegate to evaluation.execution_for/assess_for_feedback. CandidateProvider, EvidenceCapture, read_attempt_view remain re-exports, so tests/test_apps_module_migrations.py:273-280 (api.EvaluationPort.__module__) and tests/check_installed.py:20 still hold.
  • Boundary requested on #635 is resolved, not deferred. My 18:59Z note asked for one of two options on EvaluationPort/Assessor. #635 §4 now fixes it: definitions stay in api.py, the implementation takes plain callables and does not import apps.api. This PR implements exactly that — _assess_record takes Callable[..., dict], and workflows/evaluation.py imports only ..handoff / ..storage, so no reverse edge into apps.api exists.
  • Moved bodies are the previous ones. Prepare/execute/assess orchestration, _bind_archived_execution, _assessment_request, _assess_record, execution_for, assess_for_feedback retain their validation order, including the selected-claim check before an assessment becomes durable. Import depth and annotations are the only edits.
  • Injection points follow the implementation. Both archive-failure tests patch the real owner now (tests/test_apps_assess.py:171, tests/test_benchmark_assessment.py:480), which is required because the helpers are gone from api.
  • Migration inventory is consistent, not just edited. docs/apps-module-migrations.json:33,71,109,155 add workflows/evaluation.py to the archive, artifact-reader, result and bridge consumer lists, and api.py is dropped where it no longer imports them. I checked this against the one-directional rule in tests/test_apps_module_migrations.py:165-188: every canonical target evaluation.py imports is registered, and every remaining api.py import of a canonical module is still listed.
  • No digest registration is owed by this slice. harness/optimization_session.py:114-127 (_runtime_identity) and tools/skill_eval_compare.py:40-50 (CONTROLLERS) enumerate the files whose content is fingerprinted; neither covers evaluation orchestration, so adding workflows/evaluation.py to a runtime digest is not part of this change. The path-registration check I raised on #635 stays with the root-module moves (knowledge, parallel_round, artifacts, inspection).
  • Docs match. src/inferrsi/apps/README.md points at the implementation, and docs/module-layout.md:44 still describes EvaluationPort as defined in apps/api.py — correct after this commit.

Independent re-check status. Head 7410e25b carries three formal Approves (@david6666666, @amy-why-3459, @Bounty-hunter), with no outstanding CHANGES_REQUESTED. This vote is therefore not load-bearing for the merge gate.

Not verified here. I did not run the suite or open CI myself; I am relying on the seeded Ready run cited in Amy's review plus the author's reported targeted runs. I also did not sweep the whole tree for private-helper patch sites, so my statement about patch locations covers the two files this diff changes.

Optional follow-ups (non-blocking)
  • api.assess(..., assess_benchmark: Assessor, ...) still types the port as the protocol while evaluation.assess/_assess_record accept Callable[..., dict]. The internal helper is now unchecked by the protocol, so a future port-shape change would surface at runtime instead of in type checking. Keeping the protocol on the workflow functions would preserve that check.
  • The second #635 slice should land the patch-location and fingerprint checks together with the root-module moves, as the issue's step 1 requires.

Dong-bot (authorized delegate) — recording this verdict on @Dong1017's behalf; I'll re-read after any author push.


@Dong1017

Copy link
Copy Markdown
Collaborator

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

不补正式 verdict——这版 PTAL 已在精确头 7410e25b 上答复完毕:amy-why-3459 的第二次独立检视在 18:20Z 给了 Approve(6044940603),本账号随后在同一精确头 20:51Z 提交了正式 Approve(6047194822),PR 已于 19:47Z 以 squash 合入 86060880,无悬挂 CHANGES_REQUESTED,再发一份 Approve 只是重复。

diff 复核(base `c159b9ca` → head `7410e25b`,diffComplete: true)
  • 公共面不变:src/inferrsi/apps/api.py:95-107 的 EvaluationPort(含 deepcopy(storage_config))和 Assessor 仍定义在 api.py,EvaluationPort.__module__ 断言不受影响;prepare/execute/assess/execution_for/assess 只转调 evaluation.*,实参逐一对应旧实现。
  • 无反向依赖:task: 二次整理 Apps 目录,根层仅保留必要入口,其余按模块归类 #635 §4 的两个选项里落的是“定义留 api、实现只吃 callable”——workflows/evaluation.py 仅 import ..handoff.bridge、..storage.*、contracts/harness,不 import apps.api;_assess_record 收 Callable[..., dict]。
  • 实现体是原函数体:_prepare_request、_execute_saved、_port_error、_bind_archived_execution、_assess_record、assess_for_feedback 逐行搬移,校验顺序(含 primary claim 检查早于 assessment 落盘)未变。
  • 测试注入点跟随实现:tests/test_apps_assess.py:171、tests/test_benchmark_assessment.py:480 改 patch inferrsi.apps.workflows.evaluation.archive_assessment。
  • 迁移清单自洽:docs/apps-module-migrations.json 把 workflows/evaluation.py 加进 archive(:33)/artifact_reader(:71)/result(:109)/bridge(:155) 四张 consumers 表,并只从 result(:97-112) 与 bridge(:148-165) 删掉 api.py,仍保留在 archive(:23) 与 artifact_reader(:65)——与 api.py 剩余的 ResourceReader/RunOutput、AssessmentArtifacts 直接 import 吻合。

未验证:本次未运行测试,也未全树检索已移走私有名的旧引用;依据是 diff 全文、迁移清单与 Ready CI 结果。

与 #637 7142852929、#641 7145751787 的处理一致:head 已有当前 head Approve、无悬挂 CHANGES_REQUESTED 且已合入时,本账号不再补发 verdict。Dong-bot(授权代理)。

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

Labels

area:apps Apps line: CLI, Python entrypoints, host inspection, workflows, views, and adapters kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants