Skip to content

refactor(apps): give Apps its artifact helpers and the provider modules, remove infra and model - #535

Merged
Dong1017 merged 10 commits into
mainfrom
impl/498-s3b-4-5
Nov 20, 2026
Merged

Dong1017 merged 10 commits into
mainfrom
impl/498-s3b-4-5

Conversation

@Dong1017

@Dong1017 Dong1017 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Governing Issue and delivery slice

Refs #498

  • Accepted scope: slices 3b, 4 and 5 of task: retire the infra/ and model/ packages into their owning modules #498 as one PR, by the owner's decision (issuecomment-7002457678). The task: retire the infra/ and model/ packages into their owning modules #498 body lists the checks each slice carries.
  • What this PR delivers: the last two packages outside the four cores and the two technical leaves are removed, with no forwarder or alias.
    • Slice 3b, Apps owns its artifact helpers: apps/artifacts.py holds sha256, digest, file_lock, write_json and atomic_write_json, with the same function source as harness/artifact_primitives.py and benchmark/artifacts.py. apps/delivery/, the tools, the examples and the tests import it. tests/test_artifact_helper_copies.py keeps the three copies equal.
    • Slice 4, provider modules to apps/integrations/anthropic/: anthropic_agent.py, anthropic_edit_agent.py and request_guard.py move with git mv. Only the two path-valued SOURCE constants change. tools/skill_eval_compare.py hashes the new files as controllers.
    • Slice 5, infra/ and model/ are deleted:
      • The optimization session's runtime identity no longer hashes infra/artifacts.py.
      • The gate retires the two package names as a whole.
      • A package-directory guard allows exactly apps, benchmark, contracts, harness, knowledge and resources, and rejects a returning infra/ or model/, a new sibling package and a missing one.
      • ci-merge.yml stops asserting that the two directories exist, and the Windows job in ci-ready.yml compares the Harness copy with the Apps copy and runs the new lock test.
  • What it does not deliver: the harness/scenarios/ rename and the other directory-name cleanups (task: retire the infra/ and model/ packages into their owning modules #498 body, "Out of scope").

Knowledge authorship declaration

No path protected by docs/knowledge-model-policy.md changes. The declaration below is disclosure only.

{"schema_version":1,"head_sha":"19ea7abc34262206d4949810d1194b19dfa4845d","human_only":false,"material_ai_authors":[{"tool":"Claude Code","model_id":"claude-opus-5-5","effort":"xhigh","role":"author"}]}

Changed artifacts and evidence

Requirement (#498) Actual change Check / evidence Remaining gap
Apps copy of the helpers apps/artifacts.py, equal to the former infra/artifacts.py apart from its header test_artifact_helper_copies.py compares source, retry constants and written bytes across the three copies none
Cross-process .session.lock regression (slice 3b) tests/test_session_lock_across_processes.py starts a separate process for each holder Both directions, Harness holder against Apps contender and the reverse, show that a held lock excludes the other copy and is released. tests/session_lock_probe.py builds a valid managed session that is still active (one round, no final), holds its .session.lock from a separate Harness process, and shows that the Apps export_bundle is refused and publishes nothing while held; after release the same export publishes and reads back with export.kind == "progress". The same probe runs from tests/check_installed.py against the installed wheel (ready lane, Windows and macOS host job, release job). #494 stays separate: on Windows a busy lock still surfaces as PermissionError instead of the retryable busy-writer error, on unmodified main too. The probe asserts that the export does not publish, not that mapping.
Provider move with the broker logic unchanged (slice 4) git mv of the three files; the only content change is the two SOURCE values A rename-aware diff shows two changed lines in two files and none in anthropic_edit_agent.py. check_installed.py loads the agent from the installed wheel under python -I, finds the adjacent request_guard.py, and makes no provider call. none
Runtime identity infra/artifacts.py leaves _runtime_identity() tests/fixtures/optimization-session/pre-infra-removal-session/ is a whole session that main 6bdc86ee started and interrupted with its own installed runtime, unedited: it holds a completed execution receipt for an unsettled round, calls.log shows one candidate run, and its plan.json names infra/artifacts.py. test_a_session_planned_before_the_infra_removal_is_refused_and_left_unchanged copies it, asserts the receipt, and shows that status and recover both exit 2 with "Optimization runtime changed" and that no file changes. tests/check_installed.py does the same with the installed wheel (INFERRSI_PRE_INFRA_SESSION). The fixture README records the paired-wheel result on these same files. none
Package directories test_package_root_inventory.py Negative cases for a returning infra/ or model/, a new sibling and a missing directory; a Git view that reports a new package before it is staged and ignores bytecode none
Old paths fail, with or without a file RETIRED_MODULES is now the two package names Gate controls cover absolute, relative, package-initializer and cross-core imports of every old module, and a returning file none
No forwarder in the wheel tests/check_installed.py Every old module is absent: find_spec returns None or raises ModuleNotFoundError naming the missing top part of the path, and import_module fails the same way; neither directory is in the wheel; the new modules ship installed-package on this PR

Checks and dependencies

  • Checks actually run:
    • Two-runtime check on H200, scripts and results in the PR conversation. The old runtime is main 6bdc86e and the new one is c5051f8, the merge of main into this branch. Later commits change only tests, so the runtime files are the same:
      • The old runtime starts a session, records the bottleneck evidence that main now requires, and is interrupted after a round's child completes, leaving its receipt.
      • The new wheel refuses status and recover with exit 2, and all 15 session files stay byte-identical.
      • The old runtime recovers from the retained receipt, with a single candidate run in calls.log.
      • In a disposable venv, changing the installed harness/serving/server.py makes status refuse its own untouched plan, and its 8 files stay unchanged.
    • A/B on H200 over 223 test files, baseline main 6bdc86e, candidate c5051f8: 424 and 426 failed. The 2 candidate-only failures were in tests: the new lock probe had no bottleneck evidence before its first round, and the reverse-dependency test applied the old model/ rule, no Harness import, to Cannbot. 4f6a277 fixes both. Their H200 rerun was not run. CI full-check on the pushed head is the full-suite evidence for the fixes. The 424 shared failures are environment failures on both sides: H200's git 2.34 rejects --no-lazy-fetch, and some tests need playwright, node or network.
    • Gate and lint: first_wave_report() gives violations == () and blockers == (), and isolation_complete is true. Ruff 0.14.10 passes on every file this PR changes. It reports 34 F811 hits in files this PR does not touch, which are identical on main.
    • Local Windows on 19ea7ab: the lock tests, the pre-removal and pre-serving refusal tests and test_first_wave_isolation_policy.py pass. The full set is too slow on this laptop and runs on H200.
  • Pre-removal session, paired wheels on H200 (CPU, Python 3.12, one clean venv per wheel; old = main 6bdc86ee, new = c5051f8, the merge of that commit into this branch; later commits change only tests): the old wheel started the fixture session and was interrupted after the candidate's child completed (exit 130). On a copy, the new wheel exits 2 for status and recover, and the SHA-256 of all 14 files is unchanged. On the same copy, the old wheel exits 0 for recover, reports completed_rounds 1, and calls.log stays at one run, so recovery used the receipt and did not run the candidate again. The fixture's SHA-256 manifest matches the H200 files byte for byte.
  • Not run: the installed-wheel job, which installed-package on this PR runs. No provider call, NPU or GPU run: the provider modules change only their path constants.
  • Compatibility:
    • Imports of every old inferrsi.infra and inferrsi.model path fail with ModuleNotFoundError, and pickles that name them no longer load.
    • A session planned before this change is refused under the new runtime, by design. Resume it with the runtime that planned it.
    • main moved while this PR was open. c5051f8 merges 6bdc86e, which includes refactor(apps): move Cannbot adapter into integrations #528: it also adds apps/integrations/__init__.py, a docstring-only file, so the merge takes main's version and this PR adds no content to it. Conflicts were the CHANGELOG, the architecture tree and one import line in a test.
  • Dependencies: none.

Remaining work and Issue closure

Provenance

The code, tests and docs were written in a Claude Code session reported as claude-opus-5-5, effort xhigh, confirmed by the owner. This is client and session attribution, not a backend attestation. Each commit has DCO sign-off and an Agent-assisted-by line.

🤖 Generated with Claude Code

…es, remove infra and model

Slices 3b, 4 and 5 of the package cleanup. The last two packages outside the
four cores and the two technical leaves are removed, with no forwarder or alias.

Apps owns its file digests, file lock and JSON writes in apps/artifacts.py,
with the same function source as the Harness and Benchmark copies;
tests/test_artifact_helper_copies.py keeps the three equal. apps/delivery,
the tools, the examples and the tests import it. A new test starts separate
processes to show that a Harness holder and an Apps holder of the shared
.session.lock exclude each other, on Windows (msvcrt) and POSIX (flock).

The three Anthropic provider modules move to apps/integrations/anthropic with
git mv. Only the two path-valued SOURCE constants change, so tools/
skill_eval_compare.py hashes the new files as controllers. The Messages worker
still loads its adjacent request_guard.py by file location under python -I, and
the installed-wheel check loads it that way from the wheel with no provider call.

infra/ and model/ are deleted. The optimization session's runtime identity no
longer hashes infra/artifacts.py, so a plan made before this change is refused
before status or recover runs and is left unchanged. The gate retires both
package names as a whole, and a package-directory guard allows exactly the six
remaining directories and rejects a returning one, a new sibling and a missing
one. CI no longer asserts the two directories exist, and the Windows host job
compares the Harness copy with the Apps copy and runs the lock test.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
Main moved the Apps workflow modules into apps/workflows and gained the
release-boundary recovery note. Conflicts were import lines in tools and tests and
two CHANGELOG entries: every hunk keeps the workflows paths from main with this
branch's apps.artifacts and apps.integrations.anthropic imports, and both
CHANGELOG entries stay. The cold-import test blocks the new host and
integrations packages in place of infra and model.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
The A/B run found 15 candidate-only failures, all in tests that still assumed the two
packages. The synthetic Harness-edge tests build an Infra/Model tree and now switch the
retirement rule off for that one concern, which test_target_module_import_gate.py covers;
the leaf-importer tree no longer carries an empty infra package; the old Flare CLI test
expects the missing parent package; the manifest test accepts the whole-package retirement;
the not-retired control uses the modules that replaced the packages; and the template
layout test no longer expects model and infra READMEs.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
@github-actions

github-actions Bot commented Nov 20, 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 19ea7abc34262206d4949810d1194b19dfa4845d.
  • 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: 107; Canonical library paths: 0; Generated projection paths: 0; Other paths: 107. 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 19ea7abc34262206d4949810d1194b19dfa4845d. 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: 107. 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 1797804679 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: 5c7d4c45ce7ddda50e72d25f5921e1a4d77c4472821f5a62a8348185ca41e549
    Base: 6bdc86ee339c3007f15833434065adf893bff953 · Head: 19ea7abc34262206d4949810d1194b19dfa4845d
    Trusted implementation: 6bdc86ee339c3007f15833434065adf893bff953

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 (107)
  • uncovered: ".gitattributes"
  • uncovered: ".github/workflows/ci-merge.yml"
  • uncovered: ".github/workflows/ci-ready.yml"
  • uncovered: ".github/workflows/release.yml"
  • uncovered: "CHANGELOG.md"
  • uncovered: "docs/architecture.md"
  • uncovered: "docs/local-skill-evaluation.md"
  • uncovered: "docs/module-layout.md"
  • uncovered: "examples/qwen21_turbo_b300.py"
  • uncovered: "examples/qwen21_turbo_quality.py"
  • uncovered: "pyproject.toml"
  • uncovered: "src/inferrsi/apps/artifacts.py"
  • uncovered: "src/inferrsi/apps/delivery/init.py"
  • uncovered: "src/inferrsi/apps/delivery/projection.py"
  • uncovered: "src/inferrsi/apps/delivery/snapshot.py"
  • uncovered: "src/inferrsi/apps/integrations/anthropic/init.py"
  • uncovered: "src/inferrsi/apps/integrations/anthropic/anthropic_agent.py"
  • uncovered: "src/inferrsi/apps/integrations/anthropic/anthropic_edit_agent.py"
  • uncovered: "src/inferrsi/apps/integrations/anthropic/request_guard.py"
  • uncovered: "src/inferrsi/contracts/init.py"
  • uncovered: "src/inferrsi/harness/artifact_primitives.py"
  • uncovered: "src/inferrsi/harness/atomic_json.py"
  • uncovered: "src/inferrsi/harness/input_binding.py"
  • uncovered: "src/inferrsi/harness/optimization_session.py"
  • uncovered: "src/inferrsi/infra/README.md"
  • uncovered: "src/inferrsi/infra/init.py"
  • uncovered: "src/inferrsi/infra/artifacts.py"
  • uncovered: "src/inferrsi/model/README.md"
  • uncovered: "src/inferrsi/model/init.py"
  • uncovered: "src/inferrsi/model/anthropic_agent.py"
  • uncovered: "src/inferrsi/model/anthropic_edit_agent.py"
  • uncovered: "src/inferrsi/model/request_guard.py"
  • uncovered: "tests/_gate_policy_support.py"
  • uncovered: "tests/check_installed.py"
  • uncovered: "tests/fixtures/harness_improvement_demo.py"
  • uncovered: "tests/fixtures/optimization-session/README.md"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/calls.log"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/campaign.json"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/frozen/TASK.md"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/frozen/baseline.py"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/frozen/benchmark.py"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/frozen/optimization.py"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/plan.json"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/rounds/round-01/attempt-c8293054fed14a4789d192d1f43787c3/candidate.py"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/rounds/round-01/attempt-c8293054fed14a4789d192d1f43787c3/execution/execution.json"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/rounds/round-01/attempt-c8293054fed14a4789d192d1f43787c3/execution/stderr.log"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/rounds/round-01/attempt-c8293054fed14a4789d192d1f43787c3/execution/stdout.log"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/rounds/round-01/attempt-c8293054fed14a4789d192d1f43787c3/measurement/result.json"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/state.json"
  • uncovered: "tests/fixtures/optimization-session/pre-infra-removal-session/work/candidate.py"
  • uncovered: "tests/fixtures/skill_eval_compare_support.py"
  • uncovered: "tests/fixtures/skill_eval_pr_support.py"
  • uncovered: "tests/session_lock_probe.py"
  • uncovered: "tests/test_anthropic_agent.py"
  • uncovered: "tests/test_anthropic_edit_agent.py"
  • uncovered: "tests/test_anthropic_full_context.py"
  • uncovered: "tests/test_apps_module_migrations.py"
  • uncovered: "tests/test_artifact_helper_copies.py"
  • uncovered: "tests/test_campaign_trace.py"
  • uncovered: "tests/test_first_wave_isolation_policy.py"
  • uncovered: "tests/test_flare_adapter.py"
  • uncovered: "tests/test_goal_checkpoint.py"
  • uncovered: "tests/test_image_modules.py"
  • uncovered: "tests/test_inspection.py"
  • uncovered: "tests/test_knowledge_compatibility_shells.py"
  • uncovered: "tests/test_legacy_run_split.py"
  • uncovered: "tests/test_module_boundaries.py"
  • uncovered: "tests/test_optimization_session.py"
  • uncovered: "tests/test_package_root_inventory.py"
  • uncovered: "tests/test_project_service_reuse.py"
  • uncovered: "tests/test_repository_packs_facade.py"
  • uncovered: "tests/test_request_guard.py"
  • uncovered: "tests/test_request_guard_deadline.py"
  • uncovered: "tests/test_result_delivery.py"
  • uncovered: "tests/test_session_lock_across_processes.py"
  • uncovered: "tests/test_sias_layout.py"
  • uncovered: "tests/test_skill_eval_auto.py"
  • uncovered: "tests/test_skill_eval_auto_daily.py"
  • uncovered: "tests/test_skill_eval_compare.py"
  • uncovered: "tests/test_skill_eval_deployment.py"
  • uncovered: "tests/test_skill_eval_diagnostic.py"
  • uncovered: "tests/test_skill_eval_feedback.py"
  • uncovered: "tests/test_skill_eval_generation.py"
  • uncovered: "tests/test_skill_eval_historical_job.py"
  • uncovered: "tests/test_skill_eval_local.py"
  • uncovered: "tests/test_skill_eval_local_cli.py"
  • uncovered: "tests/test_skill_eval_pipeline.py"
  • uncovered: "tests/test_skill_eval_planned_guidance.py"
  • uncovered: "tests/test_skill_eval_planning_boundaries.py"
  • uncovered: "tests/test_skill_eval_pr.py"
  • uncovered: "tests/test_skill_eval_pr_diagnostic.py"
  • uncovered: "tests/test_skill_eval_retention.py"
  • uncovered: "tests/test_skill_eval_review_guidance.py"
  • uncovered: "tests/test_skill_evaluation.py"
  • uncovered: "tests/test_target_module_import_gate.py"
  • uncovered: "tests/test_template_layout.py"
  • uncovered: "tests/test_yibuapi_runtime.py"
  • uncovered: "tools/goal_checkpoint.py"
  • uncovered: "tools/skill_eval_auto.py"
  • uncovered: "tools/skill_eval_cloud_export.py"
    Additional paths omitted; see retained evidence.

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Evidence for head ed44f7f901bd384aae1d6098780ab72299ea2e24.

Two-runtime check with one untouched session

Setup:

  • Host: H200 Linux, Python 3.12.13.
  • Old runtime: main 4934165.
  • New runtime: a4af7e7. ed44f7f changes only tests.
  • Build: each side is a git archive checked against a per-file SHA-256 manifest and built as a wheel. Each wheel is installed with --no-deps --no-index into its own venv, and the same driver runs under python -I from outside both trees.
Step Runtime Result
1 session start old exit 0
2 session round; the coordinator is interrupted after the child completes old exit 130; the receipt is retained
3 session status new wheel exit 2: Optimization runtime changed, use its frozen runtime to resume
4 session recover new wheel exit 2, same message
— session files before step 3 and after step 4 — all 15 files have identical SHA-256
5 session recover old exit 0: completed_rounds 1
6 session status old exit 0
— calls.log — 2 once: the candidate was not run again

The old plan's runtime identity hashes infra/artifacts.py, which this PR removes: that is why the new wheel refuses it.

steps.log
verify-old=0
build-old=0
venv-old=0
install-old=0
wheel-old ffc43b735fe8122e0065ebba303141c4dd3c5d9941e354b0fe09c246649ead75  inferrsi-0.1.0.dev0-py3-none-any.whl
verify-new=0
build-new=0
venv-new=0
install-new=0
wheel-new 143cd48fbef42f859c9ed449b2b9c26718a9b71c1aab6566c8c47d842300376e  inferrsi-0.1.0.dev0-py3-none-any.whl
step1 old start exit=0
step2 old interrupted-round 2 exit=130
step3 new status exit=2
step4 new recover exit=2
session-unchanged-by-new=0 files=15
plan-names-infra-processes=0
step5 old recover exit=0
step6 old status exit=0
calls.log=2,
done

Changed installed server bytes with an untouched plan. In a disposable venv of the new wheel, a session starts and status exits 0. The installed harness/serving/server.py is then changed, and status exits 2 with the same message and the 8 session files unchanged.

drift.log
server=$WORK/drift-venv/lib/python3.12/site-packages/inferrsi/harness/serving/server.py
drift-step1 start exit=0
drift-step2 status exit=0
server-before 2ca1984373423b190b13523fa76ce760e74cc851bbd29b0e532d8d7e92e62c8d  $WORK/drift-venv/lib/python3.12/site-packages/inferrsi/harness/serving/server.py
server-after 52d0d05ca97ca66b87c983436ce49f89c6f1646ca191b9bf31e170d29faa6a99  $WORK/drift-venv/lib/python3.12/site-packages/inferrsi/harness/serving/server.py
drift-step3 status exit=2
session-unchanged-by-drift=0 files=8
done

A/B over 113 related test files

Baseline is main 4934165. The candidate is this head.

Run Failed Passed Skipped Candidate-only failures
baseline 336 2699 150 —
a4af7e7 359 2698 151 15
ed44f7f (this head) 339 2713 151 0

The 15 failures at a4af7e7 were in tests that still assumed the removed packages. ed44f7f fixes them in the test files only. The failures that both sides share are H200 environment ones: its git 2.34 rejects --no-lazy-fetch, and some tests need playwright, node or network access.

Reproduction

Put the two archives, their manifests and verify.py (the per-file SHA-256 check) in $WORK, then run two_runtime.sh followed by installed_drift.sh.

two_runtime_driver.py
import json
import sys
from pathlib import Path

# Drive one optimization session through the installed inferrsi of this interpreter.
# The same driver runs under the pre-move and the new runtime, so only the runtime
# differs. Usage: two_runtime_driver.py <workdir> <command> [factor]
from inferrsi.apps.cli import main
from inferrsi.benchmark import registry
from inferrsi.harness import optimization_session

work, command = Path(sys.argv[1]), sys.argv[2]
library = work / "library"
session = work / "session"
registry._library_root = lambda: library


def write_task():
    # The synthetic CPU task from tests/test_optimization_session.py::task.
    task = library / "test-work"
    task.mkdir(parents=True)
    (library / "index.json").write_text(
        json.dumps({"schema_version": 1, "packages": [task.name]}), encoding="utf-8")
    (task / "TASK.md").write_text("Synthetic protocol control\n", encoding="utf-8")
    (task / "baseline.py").write_text("FACTOR = 1\n", encoding="utf-8")
    (task / "optimization.py").write_text(
        "import json\n"
        "def validate_arguments(args):\n    assert not args\n    return {}\n"
        "def arguments(candidate, output, settings):\n"
        "    return [str(candidate), str(output)]\n"
        "def assess(directory, settings, execution):\n"
        "    return json.loads((directory / 'measurement/result.json').read_text())\n",
        encoding="utf-8")
    (task / "benchmark.py").write_text(
        "import json, runpy, sys\nfrom pathlib import Path\n"
        "value = runpy.run_path(sys.argv[1])['FACTOR']\n"
        "output = Path(sys.argv[2])\noutput.mkdir()\n"
        "with Path('calls.log').open('a') as stream:\n    stream.write(str(value) + '\\n')\n"
        "status = 'completed' if value > 0 else 'candidate_failure'\n"
        "result = {'status': status, 'verdict': 'PASS' if value > 0 else 'FAIL',\n"
        "          'score': value if value > 0 else None}\n"
        "(output / 'result.json').write_text(json.dumps(result))\n",
        encoding="utf-8")


def run(argv):
    try:
        return main(argv)
    except SystemExit as stopped:
        return stopped.code


if command == "start":
    write_task()
    code = run(["benchmarks", "session", "start", "test-work", "--session", str(session),
                "--rounds", "3", "--max-minutes", "5", "--evaluation-timeout-seconds", "15",
                "--condition", "synthetic-current-agent", "--evaluation-args", ""])
elif command == "interrupted-round":
    # As in test_recovery_collects_completed_execution_without_running_candidate_twice:
    # the child finishes and leaves its receipt, then the coordinator is interrupted.
    original = optimization_session._session_execute

    def crash_after_execution(*args):
        original(*args)
        raise KeyboardInterrupt("coordinator interrupted after child completion")

    optimization_session._session_execute = crash_after_execution
    candidate = session / "work/candidate.py"
    candidate.write_text(f"FACTOR = {sys.argv[3]}\n", encoding="utf-8")
    try:
        code = run(["benchmarks", "session", "round", "--session", str(session),
                    "--candidate", str(candidate), "--hypothesis", "two-runtime check"])
    except KeyboardInterrupt as interrupted:
        print(json.dumps({"interrupted": str(interrupted)}))
        code = 130
elif command in ("status", "recover"):
    code = run(["benchmarks", "session", command, "--session", str(session)])
else:
    raise SystemExit(f"unknown command {command}")
sys.stdout.flush()
sys.exit(code)
two_runtime.sh
#!/usr/bin/env bash
# Two-runtime release-boundary check for #498 slice 2. One untouched session:
# the pre-move runtime starts it and leaves an interrupted round with its receipt, the
# new installed wheel must refuse it without changing any session file, and the
# pre-move runtime must then recover it from its receipts.
set -u
work=${WORK:?set WORK to a directory holding the inputs}
cd "$work"
rm -f steps.log
log() { echo "$*" >> steps.log; }
for side in old new; do
  rm -rf "tree-$side" "venv-$side" "dist-$side" && mkdir "tree-$side" "dist-$side"
  tar -xf "$side.tar" -C "tree-$side"
  python3 -I verify.py "tree-$side" "MANIFEST-$side.json" > "verify-$side.json"; log "verify-$side=$?"
  SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0.dev0 python3 -m pip wheel --no-deps --no-build-isolation \
    -w "dist-$side" "./tree-$side" > "build-$side.log" 2>&1; log "build-$side=$?"
  python3 -m venv --without-pip "venv-$side"; log "venv-$side=$?"
  python3 -m pip --python "venv-$side/bin/python" install --no-deps --no-index \
    "dist-$side"/inferrsi-*.whl > "install-$side.log" 2>&1; log "install-$side=$?"
  (cd dist-$side && sha256sum inferrsi-*.whl | sed "s/^/wheel-$side /") >> steps.log
  "venv-$side/bin/python" -I -c "import inferrsi, pathlib; print('location-$side', pathlib.Path(inferrsi.__file__).parent)" >> steps.log
done
rm -rf run && mkdir run
step=0
run() {
  local side=$1; shift; step=$((step + 1))
  (cd "$work/run" && "$work/venv-$side/bin/python" -I "$work/two_runtime_driver.py" "$work/run" "$@" \
    > "$work/out-$step-$side-$1.txt" 2> "$work/err-$step-$side-$1.txt")
  log "step$step $side $* exit=$?"
}
manifest() { (cd "$work/run/session" && find . -type f -print0 | sort -z | xargs -0 sha256sum) > "$work/$1"; }
run old start
run old interrupted-round 2
manifest manifest-before-new.txt
run new status
run new recover
manifest manifest-after-new.txt
cmp -s manifest-before-new.txt manifest-after-new.txt; log "session-unchanged-by-new=$? files=$(wc -l < manifest-before-new.txt)"
grep -c '"infra/processes.py"' run/session/plan.json | sed 's/^/plan-names-infra-processes=/' >> steps.log
run old recover
run old status
log "calls.log=$(tr '\n' ',' < run/session/calls.log 2>/dev/null)"
log done
tar -czf results.tgz steps.log manifest-before-new.txt manifest-after-new.txt out-*.txt err-*.txt
installed_drift.sh
#!/usr/bin/env bash
# Installed-wheel drift check for #498 slice 2: the new wheel starts a session, then the
# installed harness/serving/server.py changes in a disposable venv. The untouched plan
# must be refused, and no session file may change.
set -u
work=${WORK:?set WORK to a directory holding the inputs}
cd "$work"
rm -f drift.log
log() { echo "$*" >> drift.log; }
rm -rf drift-venv && cp -a venv-new drift-venv
server=$(drift-venv/bin/python -I -c "import inferrsi.harness.serving.server as s; print(s.__file__)")
log "server=$server"
rm -rf drift && mkdir drift
step=0
run() {
  step=$((step + 1))
  (cd "$work/drift" && "$work/drift-venv/bin/python" -I "$work/two_runtime_driver.py" "$work/drift" "$@" \
    > "$work/drift-out-$step-$1.txt" 2> "$work/drift-err-$step-$1.txt")
  log "drift-step$step $* exit=$?"
}
manifest() { (cd "$work/drift/session" && find . -type f -print0 | sort -z | xargs -0 sha256sum) > "$work/$1"; }
run start
run status
manifest drift-manifest-before.txt
sha256sum "$server" | sed 's/^/server-before /' >> drift.log
printf '\n# changed canonical bytes\n' >> "$server"
sha256sum "$server" | sed 's/^/server-after /' >> drift.log
run status
manifest drift-manifest-after.txt
cmp -s drift-manifest-before.txt drift-manifest-after.txt; log "session-unchanged-by-drift=$? files=$(wc -l < drift-manifest-before.txt)"
log done
tar -czf drift-results.tgz drift.log drift-manifest-*.txt drift-out-*.txt drift-err-*.txt

Not claimed:

  • This check runs outside CI, because it needs two wheels.
  • No provider call, GPU or NPU was used.
  • The ready lane on this PR is the full-suite proof, including the installed-wheel job.

@Dong1017 Dong1017 added the kind:task Bounded delivery task with a delegated slice label Nov 20, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS

初次独立检视 1b826b5f → ed44f7f9,按 #498 的 3b/4/5 切片核对。批准前需修三项:

  1. tests/check_installed.py:822–823, 842, 848–854:删掉 inferrsi.model / inferrsi.infra 后,对子模块直接 find_spec() 会因父包不存在抛 ModuleNotFoundError,先于下方受保护的 import 检查中止 wheel 验证。旧 Flare 命令也不再能保证报缺 .validators,因为先缺父包。让负向检查接受预期的父包缺失,同时保留旧路径确实不可导入的断言。
  2. tests/test_session_lock_across_processes.py:23,135–145:目前从 checkout 导入,持锁时只测原始锁,释放后唯一实际 export 仍对不完整 fixture 预期失败。#498 3b 要求用已安装 wheel 和有效 session,让独立 Harness 进程持锁时实际 Apps progress export 被拒绝,释放后同一操作成功;#494 异常类型可以分开验收。
  3. Slice 5 改变 session runtime identity。当前保留的恢复 fixtures 测的是更早的迁移,不含紧邻本切片的 infra/artifacts.py identity。请用原始固定计划覆盖升版后的 status/recover 均在分派前拒绝且不改写原计划。

组合时另留意 #528 也新增 apps/integrations/__init__.py,两份都是无导入 docstring;后落的一侧需统一该文件和共享检查,不把这项重叠当成本轮独立代码结论。已静态核对实际差异、#498 与测试定义;未运行 wheel、设备测试、合并演练或查询 CI。

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Independent third-party tip COMMENT (cursor[bot]; not Approve / not Request changes).

First cursor look at head ed44f7f901bd384aae1d6098780ab72299ea2e24 (Dong1017-authored #498 slices 3b/4/5). Merge state is DIRTY/CONFLICTING with main — rebase required before any formal vote.

I independently confirm zengchuang-hw tip NO PASS blockers are still open, including:

  • tests/check_installed.py retired-path checks call find_spec("inferrsi.model…") / find_spec("inferrsi.infra…") after parent packages are removed; missing parents raise ModuleNotFoundError before the protected import assertions / Flare CLI expectations can run.
  • Additional zeng items on wheel verification / Flare retired-path signaling remain author-owned.

No formal Approve while dirty + open NO PASS. Technical/third-party verify only (collaborator permission none) — not write+ eligible / dual tip / merge-ready under docs/agent-collaboration.md.

Copy link
Copy Markdown
Collaborator

Independent review of 1b826b5f9666a8b734000e1eb2990e582cdef876…ed44f7f901bd384aae1d6098780ab72299ea2e24. I rechecked the three open NO PASS items against this exact diff and they still hold. GitHub also reports the PR as dirty against current main, so a rebase is needed before any formal vote.

  1. tests/check_installed.py:822–823 and :848–854 still call find_spec() on retired inferrsi.model.* / inferrsi.infra.* submodules after the parent packages have been removed. find_spec("missing_parent.child") raises ModuleNotFoundError instead of returning None, so the installed-wheel check can stop before the protected import assertions. The Flare CLI check at :835–842 still looks for No module named 'inferrsi.model.validators', but with the parent package gone Python reports No module named 'inferrsi.model' — tests/test_flare_adapter.py was already updated for that. Please make the negative checks accept a missing parent and still assert that the old paths cannot be imported.

  2. tests/test_session_lock_across_processes.py still loads the checkout (sys.path to src/, imports at the top of the file). While a Harness process holds the lock, the test only probes the raw file_lock; after release, delivery.project() is run against a fixture that has only state.json and is expected to fail. Slice 3b asked for an installed wheel and a valid session: the real Apps progress export should be refused while an independent Harness process holds the lock, and the same export should succeed after release. The bug(apps): Windows busy delivery lock escapes as PermissionError #494 exception-type mapping can stay a separate assertion.

  3. Dropping infra/artifacts.py from _runtime_identity() is an intentional compatibility break, but this head still has no in-tree fixture for it. Please cover a preserved pre-slice-5 plan so that the new runtime's status and recover both refuse before dispatch and leave the original plan byte-identical. The H200 two-runtime log in the conversation is helpful context; it does not replace a regression in the tree.

The import/move itself looks like the intended 3b/4/5 packaging change (no leftover production inferrsi.infra / inferrsi.model imports, Anthropic files moved with only SOURCE constants changing). On rebase, please also unify apps/integrations/__init__.py with #528 if both sides still add that file. I did not run the wheel job, device tests, or a merge rehearsal.

…al plan

Review of the final package-cleanup slice found three gaps in the evidence.

check_installed.py asserted a retired module by calling find_spec on a dotted name,
which raises ModuleNotFoundError about the missing parent package instead of returning
None. A helper now accepts both outcomes and requires the raised error to name the
missing top part of the path, so an unrelated missing module still fails.

The cross-process lock test used a bare lock file. A new probe builds a valid managed
session, holds its .session.lock from a separate Harness process, and shows that the Apps
export is refused and then publishes after release. The probe runs against the checkout
in the test run and against the installed wheel in check_installed.py, which the ready
lane, the Windows and macOS host job and the release job now start with the probe path.

The runtime identity of main before this slice is pinned in a fixture. The new runtime
refuses such a plan for status and recover before dispatch and leaves the plan bytes
unchanged, as it does for the plan from before the serving move.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
Main added the Cannbot integration group, the P1 preparation port, the diagnosis gate and
the source-build plugin version. Conflicts were the CHANGELOG, the architecture tree, one
import line in the result-delivery test and the integrations initializer. Both CHANGELOG
entries stay. The architecture tree keeps main's content and lists the Apps artifact file
and the Anthropic integration under apps/. The initializer takes main's docstring, since
the Cannbot change added the same file first.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
The A/B run on the merge with main found two candidate-only failures.

The lock probe built its session without the bottleneck evidence that main now requires
before any round, so it stopped at the first round. It records the evidence file next to
the session root, the same input as the shared test support, which a wheel does not ship.

The reverse-dependency test applied the old model/ rule, no Harness import, to every
module under apps/integrations. Cannbot is Apps code and imports Harness records, so the
rule now covers the Anthropic provider modules that came from model/.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

Copy link
Copy Markdown
Collaborator

Independent review of ed44f7f901bd384aae1d6098780ab72299ea2e24…4f6a277e1728a0752adfcd7fc92b184b74443f83 (merge of current main 6bdc86ee339c3007f15833434065adf893bff953 plus f3551400e42c33e6fbef921a7c994d2c3b5b2ff2 and 4f6a277e).

The three previous blockers are addressed in this increment:

  1. tests/check_installed.py now uses assert_not_importable, so a missing inferrsi.model / inferrsi.infra parent is accepted instead of aborting find_spec(), and the Flare CLI check looks for No module named 'inferrsi.model'.
  2. tests/session_lock_probe.py builds a valid managed session, holds the Harness lock in a child process, and requires delivery.export_bundle to be refused while held and to publish after release. It runs against the checkout and, via INFERRSI_SESSION_LOCK_PROBE, against the installed wheel. Linux installed-package (3.10 and 3.11) and the Windows advisory host job passed this path.
  3. tests/fixtures/optimization-session/pre-infra-removal-runtime-identity.json and test_a_plan_from_before_the_infra_removal_is_refused_and_left_unchanged cover a pre-slice-5 identity that still names infra/artifacts.py, so status and recover refuse before dispatch and leave the plan bytes unchanged.

The merge unified apps/integrations/__init__.py with #528. 4f6a277e correctly adds record_diagnosis for the #519 gate and narrows the no-Harness import rule to apps/integrations/anthropic.

One new blocker remains. On macOS the new wheel probe fails before it can observe lock contention.

host-compatibility (advisory, macos-latest) job 136344502575 on this head: check_installed.py copies the probe into a tempfile.TemporaryDirectory and tests/session_lock_probe.py:111 calls delivery.export_bundle(root, work / "busy", export_id="busy"). That destination is under /var/folders/..., which is a symlink to /private/var/folders/.... apps/delivery/__init__.py _safe_root (line 24–26) then raises ValueError: Delivery paths cannot traverse symbolic links, so the assertion at tests/check_installed.py:941 (locked.returncode == 0) fails. The ci-ready.yml comment says this check is meant to run on macOS as well as Linux and Windows.

Please materialize the session and export directories through a fully resolved, symlink-free path before calling export_bundle (and the later read_bundle), so the macOS wheel job can exercise the same lock/export contract. I did not wait for full-check to finish. The PR body knowledge declaration still names ed44f7f9; the declarations check succeeded because this diff does not touch protected paths.

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS

增量检视 ed44f7f901bd384aae1d6098780ab72299ea2e24 → 4f6a277e1728a0752adfcd7fc92b184b74443f83(新 base 6bdc86ee),承接上轮。已修复旧子模块在父包缺失时的 find_spec 检查和 Flare 失败断言。轮子检查也已改用实际 Harness 独立进程和 Apps 导出,不再只测原始锁。

#498 尚有两项未覆盖:

  1. 3b 要的是已安装 wheel 对进行中的 session 做 progress export。tests/session_lock_probe.py 先执行 final=True 再取锁,验证的是终态导出。请保留一个合法但未 final 的 session,断言持锁时拒绝且不发布,释放后同一操作成功,读回 export.kind == "progress"。不要求本 PR 同时修 #494 的异常映射。
  2. Slice 5 明确沿用 slice 2 的原始计划与 wheel 拒绝 fixture。新用例以当前 checkout 生成 plan,再替换 runtime_identity,并只用当前 checkout 验证。请保留紧邻迁移前的真实 plan 原始字节,交由新安装 wheel 验证 status/recover 在分派前拒绝且不改写;记录用固定旧 runtime 恢复该计划的路径。不要把合成旧 map 的单元测试当作这项兼容证据。

已静态核对 #498、安装检查、锁探针和恢复用例;未执行安装 wheel 或 Windows/POSIX 测试。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed 4f6a277 (tests only; src/ is byte-identical to c5051f8). No approval existed on ed44f7f, so this push voids none. Main is merged in at 6bdc86e; the PR is mergeable again.

1. find_spec on a missing parent (tests/check_installed.py)
A helper assert_not_importable now accepts both outcomes for a retired module: find_spec returns None, or it raises ModuleNotFoundError. In the second case the error's name must be a leading part of the dotted path, so an unrelated missing module still fails. import_module must fail the same way. Both retired loops use it, and the Flare CLI check expects No module named 'inferrsi.model'.

2. Lock test with a valid session and the installed wheel
tests/session_lock_probe.py builds a valid managed session (initialize, bottleneck diagnosis, one round, final), starts a separate Harness process that holds <session>/.session.lock through harness.optimization._locked, and calls the Apps export_bundle of that session. While the lock is held the export must not publish; after release the same export publishes and read_bundle reads it. It runs in two places:

  • tests/test_session_lock_across_processes.py, from the checkout.
  • tests/check_installed.py, from the installed wheel under python -I. INFERRSI_SESSION_LOCK_PROBE is passed in the installed-package job, the Windows and macOS host job, and release.yml.

#494 stays separate: the probe asserts that the export does not publish, not which exception Windows raises.

3. Pre-removal plan fixture
tests/fixtures/optimization-session/pre-infra-removal-runtime-identity.json holds the runtime identity of main 4eaf7fb (17 entries, including infra/artifacts.py), computed from that commit's own bytes. test_a_plan_from_before_the_infra_removal_is_refused_and_left_unchanged swaps it into a started session and shows that status and recover both exit 2 with "Optimization runtime changed" and that plan.json is byte-identical afterwards.

#528 overlap
Both PRs added apps/integrations/__init__.py. #528 landed first, so the merge takes main's docstring and this PR adds nothing to that file.

Evidence
H200, Python 3.12, CPU only, installed wheels in separate venvs. Old runtime = main 6bdc86e, new runtime = c5051f8:

  • The old runtime starts a session, records the diagnosis, and is interrupted after a round's child completes (exit 130). The plan names infra/artifacts.py.
  • The new wheel refuses status and recover (exit 2). All 15 session files are byte-identical.
  • The old runtime then recovers (exit 0); calls.log shows the candidate ran once.
  • Drift check: after changing the installed harness/serving/server.py, the new wheel refuses its own untouched plan (exit 2); 8 files unchanged.

A/B over 223 test files, base 6bdc86e against c5051f8: 424 and 426 failed, with 2 candidate-only failures, both in tests and fixed in 4f6a277:

  • The new probe had no bottleneck evidence before its first round (main now requires it).
  • test_shared_layers_do_not_import_campaigns_or_reverse_dependencies applied the old model/ rule (no Harness import) to all of apps/integrations, so it failed on Cannbot. It now covers apps/integrations/anthropic, the modules that came from model/.

The 424 shared failures are environment failures on both sides (git 2.34 rejects --no-lazy-fetch, missing playwright, node or network). Local Windows run on 4f6a277: the lock tests, both refusal tests and the reverse-dependency test pass. test_progress_uses_committed_control_and_a_fixed_clock fails on this laptop with the Windows PermissionError, and fails the same way on unmodified main (#494).

Not yet run on 4f6a277: the H200 rerun of the four affected test files. I will post that result here, and the PR body does not claim it.

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Posted by an agent on behalf of @Dong1017 (incremental review only; items already raised by others or fixed by the author are not repeated).

Incremental review of ed44f7f901bd384aae1d6098780ab72299ea2e24 → 4f6a277e1728a0752adfcd7fc92b184b74443f83, reading mainly what f3551400e42c33e6fbef921a7c994d2c3b5b2ff2 and 4f6a277e bring in.

DO NOT PASS. Two items block on this head. The first is new: the required test job is red, and it finished after the previous review comment was posted.

1. full-check fails on this head (new)

full-check (3.10) (job 136344502566, 14:38:56Z) and full-check (3.11) (job 136344502534, 14:34:22Z) both report 3 failed, 5709 passed, 31 skipped. All three are subTests of one test:

tests/test_first_wave_isolation_policy.py::StagedIsolationTest::test_each_trigger_alone_keeps_overall_false — the three triggers that build a synthetic infra/ or model/ tree. Each now trips the wholesale retirement rule, so report.violations at tests/test_first_wave_isolation_policy.py:1339 is a non-empty tuple where the test asserts ():

'inferrsi.infra is a retired module'
'inferrsi.infra.artifacts is a retired module'
'inferrsi.harness.skill_evaluation imports retired module inferrsi.infra.artifacts'
'inferrsi.model is a retired module'
'inferrsi.model.metrics is a retired module'
'inferrsi.bridge imports retired module inferrsi.model'

This is the same cause ed44f7f9 already handled for the two neighbouring tests: test_returning_skill_evaluation_infra_edge_fails (:1203) and test_returning_r2_harness_infra_edges_fail (:1240) carry @mock.patch.object(support, "RETIRED_MODULES", frozenset()), and the K01 tree dropped its empty infra/__init__.py. test_each_trigger_alone_keeps_overall_false (:1297) builds the same synthetic trees and was left out, so ed44f7f9's statement that "the synthetic Harness-edge tests build an Infra/Model tree and now switch the retirement rule off for that one concern" covers only part of them.

It is not a fresh regression: the test fails at 3b3e5cb6 and at ed44f7f9 as well, and it passes at base 6bdc86ee. It surfaces only now because the branch was a draft until this head — the ready lane first ran on 4f6a277e, and the earlier head has no full-check run at all.

I reproduced it at 4f6a277e on Linux/Python 3.12 and got the identical tuple; the same file passes on 6bdc86ee. Adding the one decorator the two siblings already carry makes the file green (55 passed), so the fix is the existing pattern applied to the third test.

2. The macOS blocker holds, and the obvious fix is not sufficient

The previous comment's finding is correct on this head, beyond the job log: host-compatibility (advisory, macos-latest) job 136344502575 fails at check_installed.py:941 because the probe aborts with ValueError: Delivery paths cannot traverse symbolic links.

One refinement, because resolving only export_bundle's destination will not fix it. _safe_root runs on the session root as well as on the destination — apps/delivery/__init__.py:114 in project(), :177 in export_bundle, :138 in read_bundle — and in the probe the session root work / "campaign" is created under the TemporaryDirectory itself. I reproduced the two cases locally through a symlinked parent:

resolve output only : status=error   error='Output publication validation failed; no output was published.'
resolve both        : status=published

So resolving work once at entry to main() (tests/session_lock_probe.py:94) covers the session, both export destinations and the read_bundle call at :126, and nothing derived from it can carry the symlink again. Patched that way, the probe prints {"busy_status": "error", "busy_published": false, "released_status": "published", "released_readable": true} both through a symlinked working directory and through a normal one, which satisfies check_installed.py:943-944 unchanged.

Worth knowing while fixing it: _safe_root(output) at :177 sits before export_bundle's try, so this escapes as an exception instead of the {"status": "error"} dict every other failure returns, which is why the job aborted rather than reporting a refused export. That ordering is identical on main, so it is not a regression from this change — only the reason the failure is loud.

Checked, nothing to add

  • apps/integrations/__init__.py at this head is byte-identical to main's, so the merge with refactor(apps): move Cannbot adapter into integrations #528 resolved to main's text. 4f6a277e's narrowing of the no-Harness rule to apps/integrations/anthropic matches the module list: Cannbot is Apps code that imports Harness records, and the three provider modules that came from model/ keep the old rule.
  • No production reference to inferrsi.infra or inferrsi.model remains. The remaining mentions are CHANGELOG history, a dated audit under docs/reviews/, the historical rewrite record in docs/legacy-knowledge-manifest.json, and ci-merge.yml:23-24, which asserts the two directories are absent — correct as written. tests/test_knowledge_compatibility_shells.py passes on this head.
  • record_diagnosis is a production path, not test-only: optimization_session.py:305 serves the diagnose action through it, so tests/session_lock_probe.py:62 exercising it directly reaches the same code the CLI does.
  • The pinned pre-removal identity is honest: I hashed all 17 files at its source_commit 4eaf7fb9 and every digest matches, and the only key that differs from the current _runtime_identity() is the absent infra/artifacts.py. Six shared keys hash differently — harness/artifact_primitives.py and harness/atomic_json.py because this slice rewrote them, the other four because main moved on after the fixture's source commit.

Optional, one line and not part of the verdict: docs/module-layout.md:359 still says infra/artifacts.py stays for its other users, which this slice deletes. Those lines predate the change, so I am only noting that the PR's own row for apps/artifacts.py now contradicts the prose a few hundred lines above it.

Scope: read the increment ed44f7f9..4f6a277e plus f3551400, compared head trees with base 6bdc86ee, read the exact-head check runs and both full-check logs, and reproduced the failing test and both macOS paths locally on Python 3.12. Did not run the wheel job, the Windows job, the Chromium job, any device test, or a merge rehearsal.

…ement switch

Review of 4f6a277 found two gaps and CI found one.

The lock probe ran the final round before taking the lock, so it showed a terminal export.
It now leaves the session active: the Apps export is refused and publishes nothing while a
Harness process holds the lock, and after release the same export publishes and reads back
with export.kind progress.

The runtime-identity case swapped a pinned map into a session built by the current
checkout. The fixture is now a whole session that main 6bdc86e started with its own
installed runtime, unedited, with its plan bytes as that runtime wrote them. The checkout
test and the installed-wheel check copy it and show that status and recover both exit 2
with "Optimization runtime changed" and that no file of the session changes. The README
records how it was made and how to resume such a session.

test_each_trigger_alone_keeps_overall_false builds synthetic Infra and Model packages that
the retirement rule now reports, so it switches that rule off like the two sibling tests.
Full-check failed it on 4f6a277.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

Copy link
Copy Markdown
Collaborator

Incremental review of 4f6a277e1728a0752adfcd7fc92b184b74443f83…a7f9822e539659673f0408baceae453c8738aaf6 (one commit, tests/CI/fixtures only).

Addressed in this increment:

  • Progress export (zengchuang-hw item 1): tests/session_lock_probe.py now keeps the session active (round_limit 2, no final round) and returns released_kind, and both tests/check_installed.py:945-946 and tests/test_session_lock_across_processes.py assert export.kind == "progress".
  • Real pre-removal session (zengchuang-hw item 2): the synthetic identity map is replaced by an unedited session started by main 6bdc86ee (tests/fixtures/optimization-session/pre-infra-removal-session/, marked -text, with a README on how it was made and how to resume it). The checkout test and the installed-wheel check both require status/recover to exit 2 with "Optimization runtime changed" and every session file to stay byte-identical. installed-package (3.10/3.11) and the Windows host job pass on this head.
  • test_each_trigger_alone_keeps_overall_false: gets the same RETIRED_MODULES patch as its two siblings, which matches the full-check failure reported on 4f6a277e.

Still blocking on this head:

  1. lint-and-smoke and both full-check jobs fail at ruff check src tests tools, before pytest runs (lint-and-smoke job 136462592750, full-check (3.11) job 136462634059): E401/I001 in tests/fixtures/optimization-session/pre-infra-removal-session/frozen/benchmark.py:1 and I001 in .../frozen/optimization.py:1. Do not run ruff --fix on these files: plan.json pins their bytes in frozen_files, so reformatting would invalidate the fixture. Exclude the directory instead, the same way pyproject.toml:68 already excludes tests/fixtures/legacy, e.g. extend-exclude = ["tests/fixtures/legacy", "tests/fixtures/optimization-session/pre-infra-removal-session"]. Because full-check stopped at ruff, the test_first_wave_isolation_policy.py fix and the new checkout-side refusal test have not run in CI yet. Please confirm a green full-check after the exclusion.
  2. The macOS symlink failure from my previous comment is not fixed. host-compatibility (advisory, macos-latest) job 136462634138 still fails at check_installed.py:942 with ValueError: Delivery paths cannot traverse symbolic links from tests/session_lock_probe.py:111. main() (:96) still uses work as passed. As Dong1017 noted, resolving work once at the top of main() (work = work.resolve()) covers the session root, both export destinations and read_bundle. The macOS job also runs the new pre-infra-removal wheel check after the probe, so that path is still unverified on macOS.

Minor, not blocking: the knowledge declaration in the PR body still names head_sha 4f6a277e….

What I checked: the commit diff, the probe and fixture contents, pyproject.toml, and the exact-head check runs and logs. I did not run the wheel, Windows or macOS jobs locally.

The macOS host job runs the probe in a temporary directory under /var, a symbolic link to
/private/var. The Apps export refuses any path that crosses a link, so the probe's own
work directory was rejected before the lock was tested. The probe resolves it first.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed a7f9822 and a285e31 (tests, fixtures and workflow env only; src/ is unchanged since c5051f8). No approval existed on 4f6a277, so these pushes void none. This answers the two open items in the review of 4f6a277 and a CI failure.

1. In-progress session, progress export (tests/session_lock_probe.py)
The probe no longer runs the final round. The session has one finished round and stays active. While a separate Harness process holds <session>/.session.lock, the Apps export_bundle is refused and nothing is published. After release the same export publishes, and read_bundle returns export.kind == "progress", which the checkout test and tests/check_installed.py (installed wheel) both assert. #494 is still not asserted: the probe checks only that nothing publishes.

2. A pre-migration plan in its original bytes, checked by the installed wheel
tests/fixtures/optimization-session/pre-infra-removal-session/ is a whole session that main 6bdc86ee started with its own installed wheel, with no edits (8 files; .session.lock removed; .gitattributes marks it -text so the plan bytes stay as written). Its plan.json names infra/artifacts.py. test_a_session_planned_before_the_infra_removal_is_refused_and_left_unchanged copies it, and tests/check_installed.py does the same with the installed wheel through INFERRSI_PRE_INFRA_SESSION (ready lane, host job, release job). Both require status and recover to exit 2 with "Optimization runtime changed" and every file of the copy to stay byte-identical. The synthetic pinned-map test from f355140 is gone.

Checked by hand on H200 (CPU, Python 3.12): the c5051f8 wheel refuses both with exit 2 and the 8 files stay identical; the 6bdc86e wheel answers status on a copy of the same session with exit 0. The fixture README gives the steps for making such a session and says to resume it with the runtime that started it.

3. CI full-check failure on 4f6a277
test_each_trigger_alone_keeps_overall_false failed three subtests. Three of its triggers build synthetic Infra and Model packages, which the retirement rule now reports. It now switches that rule off, as the two sibling tests already did. My H200 A/B missed this: it compared only lines starting with FAILED or ERROR, and subtest failures are reported as SUBFAILED. Comparing SUBFAILED lines as well gives exactly those three as candidate-only; the other SUBFAILED lines are the same on both sides.

4. macOS host job (advisory) on 4f6a277
The installed-wheel step failed in my probe: ValueError: Delivery paths cannot traverse symbolic links. macOS temporary directories sit under /var, a link to /private/var, and the Apps export refuses any path that crosses a link, so the probe's own work directory was rejected. The probe now resolves its work directory first. The Windows host job passed on 4f6a277; the macOS run of the new head is the evidence for this fix.

Local Windows run: ruff clean; test_first_wave_isolation_policy.py (55 passed, 287 subtests), the lock tests and both refusal tests pass. The H200 rerun of the changed tests was not run; CI on this head is the full-suite evidence.

Copy link
Copy Markdown
Collaborator

Incremental review of a7f9822e539659673f0408baceae453c8738aaf6…a285e31964bce03413182c8776652c32aa9a148e.

  • macOS fixed: tests/session_lock_probe.py:97 now runs work = work.resolve() at the top of main(), and host-compatibility (advisory, macos-latest) passes on this head. That covers the lock probe and the new pre-infra-removal wheel check on macOS. The installed-package and Windows jobs are green too.

Still blocking: ruff on the new fixture. lint-and-smoke (job 136475323731) and both full-check jobs fail again at ruff check src tests tools with the same three errors as on a7f9822e: E401/I001 in tests/fixtures/optimization-session/pre-infra-removal-session/frozen/benchmark.py:1 and I001 in .../frozen/optimization.py:1. Because of this, pytest still has not run in CI for the test_first_wave_isolation_policy.py fix or the new checkout-side refusal test. Your note says ruff was clean locally. CI installs ruff 0.17.6 and lints the whole tests tree, so a run limited to changed files or an older version would miss these.

As before, please do not reformat these files, because plan.json pins their bytes in frozen_files. Add the directory to [tool.ruff] extend-exclude in pyproject.toml (line 68 already excludes tests/fixtures/legacy), then confirm full-check is green on the new head.

What I checked: the commit diff and the exact-head check runs and logs.

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS

增量检视 4f6a277e1728a0752adfcd7fc92b184b74443f83 → a285e31964bce03413182c8776652c32aa9a148e,承接上轮检视。已确认 wheel 锁探针保留未结束的合法 session,持锁不发布,释放后读回 export.kind == "progress";探针也统一解析临时目录路径。合成 isolation 场景已局部关闭 retirement 规则,保留独立的退休模块负例。新旧 wheel 边界现在有真实旧计划作为新 wheel 的拒绝与字节不变测试输入。

批准前还有两项:

  1. tests/fixtures/optimization-session/pre-infra-removal-session/frozen/benchmark.py:1 的 import json, runpy, sys 不符合仓库启用的 Ruff E401;docs/contributing.md:14 的 ruff check src tests tools 覆盖这里,pyproject.toml:66 当前只排除 legacy fixture。请仅排除此冻结快照路径,不要重排原文件并更改计划固定的文件哈希。
  2. #498 Slice 5 沿用同一份原始计划的旧 runtime 恢复验收。当前快照的 state.json:8–9 为 rounds: []、pending: null,没有执行回执;旧 wheel 能读该快照的 status,但这不验证同一份快照从回执恢复。请保留有已完成执行回执但尚未结算的旧 runtime 快照,或把可复核的 paired-wheel 验证绑定到同一份原始计划和回执;让新 wheel 拒绝且不改字节、旧 wheel 恢复且不重跑候选。

已静态核对实际差异、锁探针、冻结 fixture 和仓库 lint 配置;未运行测试、查询 CI 或执行设备验证。

The fixture is a whole session written by an older runtime, and its plan pins the SHA-256
of each file. Ruff reported three import-style errors in its frozen task files; fixing
them would change the bytes and break the pinned plan, so the directory is excluded like
the legacy fixtures.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NO PASS

增量检视 a285e31964bce03413182c8776652c32aa9a148e → 73e19e00757aeca97c88a70f22d32578452f7e66,承接上轮检视。这次只改 pyproject.toml,精确排除了冻结会话目录;原始文件未改,lint 问题已解决。

批准前仍需补齐 #498 Slice 5 的同一会话恢复验证。当前 pre-infra-removal-session/state.json 仍是 rounds: []、pending: null 的启动快照。它能验证新 wheel 拒绝 status 和 recover 且保留原字节,但没有执行回执供固定旧 wheel 结算。请用同一份未改写的旧计划和待结算回执证明:新 wheel 拒绝且不改字节,旧 wheel 恢复且不重跑候选。也可以提供与这同一份计划和回执绑定的可复核验证。

已静态核对本轮实际 diff、冻结快照和恢复分支;未运行测试或查询 CI。

Copy link
Copy Markdown
Collaborator

Incremental review of a285e31964bce03413182c8776652c32aa9a148e…73e19e00757aeca97c88a70f22d32578452f7e66 (one commit, pyproject.toml only).

  • Ruff fixed: [tool.ruff] extend-exclude now lists tests/fixtures/optimization-session/pre-infra-removal-session next to tests/fixtures/legacy, and the fixture bytes are not touched. On this head lint-and-smoke, both full-check jobs (3.10/3.11, including the pytest step), installed-package (3.10/3.11) and the macOS/Windows host jobs are green, so the CI blocker from my last comment is resolved.

Still open before I can approve: the Slice 5 recovery half (agreeing with zengchuang-hw's review on this head). #498 slice 5 asks for "the same fail-closed recovery note and fixture as in slice 2", and slice 2 requires that "under the pinned pre-move runtime, the same plan recovers from its receipts with its retained inputs". The committed tests/fixtures/optimization-session/pre-infra-removal-session/state.json is a start snapshot: "rounds": [], "pending": null, no receipt. It proves the new wheel refuses status/recover without rewriting bytes, but it cannot show the old runtime settling a pending receipt without rerunning the candidate. Your H200 two-runtime log (comment of 2026-11-20 04:05Z) did exactly that, but on a different session than the committed fixture and before ed44f7f9.

Please either commit a pre-removal session taken after the child finished and before settlement (original bytes, .gitattributes -text as now), with the refusal tests pointed at it, or post a reproducible paired-wheel run bound to that same plan digest and receipt: new wheel refuses with files byte-identical, then old 6bdc86ee wheel recover completes the round and the candidate call count stays at one. The recovery note should name that pinned runtime.

What I checked: the commit diff, the fixture state.json at this head, #498's slice 2/5 text, and the exact-head check runs. I did not run the wheels locally.

Review of a285e31 asked for the original plan of an old runtime together with its
execution receipt, so the paired-wheel recovery is bound to the same files.

The fixture is now a session that main 6bdc86e started and interrupted with its own
installed runtime: its coordinator stopped after the candidate's child finished, so it
holds a completed execution receipt for a round that is not settled, its calls.log shows
one candidate run, and its plan names infra/artifacts.py. The checkout test and the
installed-wheel check assert that receipt and the refusal of status and recover with no
file changed. The README records the paired-wheel result on these same files: the new
wheel exits 2 and changes nothing, the old wheel recovers from the receipt and
calls.log stays at one run.

Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PASS

增量检视 73e19e00757aeca97c88a70f22d32578452f7e66 → 19ea7abc34262206d4949810d1194b19dfa4845d,承接上轮意见。#498 Slice 5 上轮的最后一项已补齐:原始旧计划未改,冻结会话现在包含未结算的 pending round、退出码为 0 的已完成执行回执和计分结果,calls.log 只记一次候选运行。现有 checkout/新 wheel 用例继续在同一份快照上断言运行时拒绝和文件字节不变。README 的双 wheel 记录绑定该 14 文件快照,说明旧 wheel 用回执结算且没有重跑候选;静态树比对确认记录中的新 wheel 源码与当前头的 src/ 一致。

批准前必做:无。已独立静态核对差异、原始计划、回执、测试和源码树;双 wheel 运行结果是作者记录,本轮未重跑测试或查询 CI。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Pushed 19ea7ab and 73e19e0 (before it, a285e31): tests, fixtures and pyproject.toml only; src/ is unchanged since c5051f8. No approval existed on any of these heads, so the pushes void none. This answers the review of 73e19e0 and the two items of the review of a285e31.

Ruff on the frozen fixture (73e19e0): pyproject.toml excludes exactly tests/fixtures/optimization-session/pre-infra-removal-session. The fixture files are unchanged, so the hashes pinned in the plan hold.

Same-session recovery (19ea7ab)
The fixture pre-infra-removal-session/ is replaced by a session that main 6bdc86ee started and interrupted with its own installed wheel, unedited (14 files; .session.lock removed). Its coordinator stopped after the candidate's child finished, so:

  • state.json has rounds: [] and a pending round of kind round;
  • the round directory has a completed execution/execution.json (returncode 0) and measurement/result.json;
  • calls.log is 2, one candidate run;
  • plan.json names infra/artifacts.py.

test_a_session_planned_before_the_infra_removal_is_refused_and_left_unchanged asserts that receipt state, then that status and recover exit 2 with "Optimization runtime changed" and that no file of the copy changes. tests/check_installed.py runs the same refusal with the installed wheel.

Paired-wheel check on this same session (H200, CPU, Python 3.12; old wheel = 6bdc86e, new wheel = c5051f8, the merge of that commit into this branch; only tests changed afterwards; one clean venv per wheel):

  1. New wheel on a copy: status exit 2, recover exit 2, "Optimization runtime changed, use its frozen runtime to resume". SHA-256 of all 14 files identical before and after.
  2. Old wheel on the same copy: recover exit 0, completed_rounds 1, calls.log still 2. Recovery used the receipt; the candidate did not run again.
  3. The fixture's SHA-256 manifest matches the H200 files byte for byte (Git Bash and Linux sha256sum differ only in the * marker).

The paired-wheel run is by hand and needs both commits installed, so it is not a CI job. tests/fixtures/optimization-session/README.md records the result and how to repeat it for a later runtime change.

Local Windows run on 19ea7ab: ruff reports only the 34 F811 hits that main has too; the refusal test and the lock tests pass. The H200 rerun of the changed tests was not run; CI on this head is the full-suite evidence.

@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

PR review verdict — PASS
Reviewed base 6bdc86ee339c3007f15833434065adf893bff953 and head 19ea7abc34262206d4949810d1194b19dfa4845d. Incremental since my last comment on 73e19e00757aeca97c88a70f22d32578452f7e66 (one commit, test fixture, README and test only; src/ unchanged).

  • Slice 5 recovery half resolved: pre-infra-removal-session/state.json now holds a pending round with rounds: [], the round directory has a completed execution/execution.json (returncode 0) and measurement/result.json, and calls.log is 2 (one candidate run). plan.json is unchanged and still names infra/artifacts.py. test_a_session_planned_before_the_infra_removal_is_refused_and_left_unchanged now asserts that receipt state before checking that status/recover refuse with every file byte-identical, and the installed-wheel check runs the same refusal on these files.
  • The fixture README records the paired-wheel run on this same 14-file snapshot (new wheel refuses with identical SHA-256, old 6bdc86ee wheel recover settles from the receipt with calls.log still 2) and how to redo it. That run is author-recorded on H200; I checked the files statically, not by rerunning both wheels. The old runtime's recover assesses from the round directory, so the absolute /tmp/pre/... paths kept in the original receipt don't need to be rewritten.
  • CI on this exact head is green: lint-and-smoke, full-check (3.10/3.11, including pytest), installed-package (3.10/3.11), macOS/Windows host jobs, declarations, pr-references.

All blockers from my earlier comments (installed-wheel negative checks, cross-process progress export, pre-removal plan refusal, macOS symlink, ruff exclusion, receipt-backed recovery) are addressed.

@Dong1017
Dong1017 merged commit fb34354 into main Nov 20, 2026
15 checks passed
@Dong1017
Dong1017 deleted the impl/498-s3b-4-5 branch November 20, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants