Skip to content

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

Open
Dong1017 wants to merge 3 commits into
mainfrom
impl/498-s3b-4-5
Open

Dong1017 wants to merge 3 commits into
mainfrom
impl/498-s3b-4-5

Conversation

@Dong1017

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":"ed44f7f901bd384aae1d6098780ab72299ea2e24","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. A Harness process holding the session also refuses the Apps copy. The Windows job runs it on windows-latest. #494 stays separate: on Windows a busy lock still surfaces as PermissionError instead of the retryable busy-writer error, on unmodified main too. This test asserts the contention, 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() Two-runtime check below 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 find_spec is None for both packages and every old module; 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 4934165 and the new one is a4af7e7:
      • The old runtime starts a session 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 completed_rounds 1 and a single candidate run.
      • In a disposable venv, changing the installed harness/serving/server.py makes status refuse its own untouched plan.
    • A/B on H200 over 113 related test files, baseline main 4934165:
      • The first run of a4af7e7 had 15 candidate-only failures, all in tests that still assumed the removed packages: the synthetic Infra and Model trees in the Harness-edge tests, a leaf-importer fixture that kept an empty infra/, the old Flare CLI message, the manifest and not-retired controls, and the template README test. ed44f7f fixes them. The rerun is in the PR conversation.
      • The other failures are the same 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.17.5 and git diff --check pass.
    • Local Windows: the new lock test passes (3 tests), and the package-directory guard and artifact-copy tests pass (43 + others). The full set was too slow on this laptop and runs on H200.
  • 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:
  • 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 ed44f7f901bd384aae1d6098780ab72299ea2e24.
  • Blockers: No verified ancestor source pin for automatic command selection. No unsafe fallback; details below.
  • Selected comparisons: 0 · Estimated task calls: 0. Uncovered/unsupported changes: 1886; Canonical library paths: 1535; Generated projection paths: 2; Other paths: 349. 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 ed44f7f901bd384aae1d6098780ab72299ea2e24. If it differs, obtain a current plan; do not reuse old results.
  2. Resolve the index source pin before checking. No verified ancestor source pin for automatic command selection. Identify the committed source matching the canonical inputs and record why it applies; do not substitute HEAD or label the projection verified.
    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: 1535; Generated projection paths: 2; Other paths: 349. 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 1797739641 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: 8551a69947bb0f8fb808c49c367791a6dd4120d4eb57e38e51d2c0ac1d22122c
    Base: 1b826b5f9666a8b734000e1eb2990e582cdef876 · Head: ed44f7f901bd384aae1d6098780ab72299ea2e24
    Trusted implementation: 1b826b5f9666a8b734000e1eb2990e582cdef876

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"}

Projection check selection (not an executed result):

{"reason":"No verified ancestor source pin for automatic command selection","status":"unavailable"}

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 (1886)
  • uncovered: ".gitattributes"
  • uncovered: ".github/workflows/ci-merge.yml"
  • uncovered: ".github/workflows/ci-ready.yml"
  • uncovered: "AGENTS.md"
  • uncovered: "CHANGELOG.md"
  • uncovered: "README.md"
  • uncovered: "docs/apple-silicon-playbook.md"
  • uncovered: "docs/architecture.md"
  • uncovered: "docs/assets/knowledge-layout/01-task-layers.png"
  • uncovered: "docs/assets/knowledge-layout/02-physical-layout.png"
  • uncovered: "docs/assets/knowledge-layout/03-search-and-delivery.png"
  • uncovered: "docs/assets/knowledge-layout/04-before-after.png"
  • uncovered: "docs/assets/modular-directory-map-en.svg"
  • uncovered: "docs/codex-plugin.md"
  • uncovered: "docs/contracts/current-design.md"
  • uncovered: "docs/contracts/diagrams/knowledge-read-and-internal-schema.mmd"
  • uncovered: "docs/contracts/figures.md"
  • uncovered: "docs/contributing.md"
  • uncovered: "docs/daily-learning-prompt.md"
  • uncovered: "docs/dashboard.md"
  • uncovered: "docs/drama3-npu-readiness.md"
  • uncovered: "docs/dsh-plugin.md"
  • uncovered: "docs/knowledge-base.md"
  • uncovered: "docs/knowledge-contribution-workflow.md"
  • uncovered: "docs/knowledge-layout.md"
  • uncovered: "docs/knowledge-operations.md"
  • uncovered: "docs/local-skill-evaluation.md"
  • uncovered: "docs/module-layout.md"
  • uncovered: "docs/operations.md"
  • uncovered: "docs/plans/2026-10-19-campaign-plan-rfc.md"
  • uncovered: "docs/quickstart.md"
  • uncovered: "docs/reference-matrix.md"
  • uncovered: "docs/reviews/issue148-flare-source-distillation.md"
  • uncovered: "docs/reviews/issue91-afd-p2p.md"
  • uncovered: "docs/reviews/issue91-afd-plugin-intake.md"
  • uncovered: "docs/reviews/issue91-akg.md"
  • uncovered: "docs/reviews/issue91-awesome-ascend.md"
  • uncovered: "docs/reviews/issue91-cannbot.md"
  • uncovered: "docs/reviews/issue91-dlrover.md"
  • uncovered: "docs/reviews/issue91-fastsafetensors.md"
  • uncovered: "docs/reviews/issue91-sd-cpp-loader-storage.md"
  • uncovered: "docs/reviews/issue91-vllm-ascend-host-offload.md"
  • uncovered: "docs/reviews/issue91-vllm-rlt-finalization.md"
  • uncovered: "docs/reviews/issue91-vllm-rlt-intake.md"
  • uncovered: "docs/searchspace-matrix.md"
  • uncovered: "docs/service-reuse-campaigns.md"
  • uncovered: "docs/skill-coverage.md"
  • uncovered: "docs/skill-eval-pr.md"
  • uncovered: "docs/skill-layout-migration.csv"
  • uncovered: "evidence/_template/plan/campaign-plan.md"
  • uncovered: "examples/qwen21_turbo_b300.py"
  • uncovered: "examples/qwen21_turbo_quality.py"
  • uncovered: "plugins/inferrsi/plugin.json"
  • uncovered: "plugins/inferrsi/skills/inferrsi/SKILL.md"
  • uncovered: "plugins/workswarm/inferrsi/manifest.json"
  • uncovered: "plugins/workswarm/inferrsi/skills/inferrsi/SKILL.md"
  • uncovered: "src/inferrsi/apps/artifacts.py"
  • uncovered: "src/inferrsi/apps/cli/init.py"
  • uncovered: "src/inferrsi/apps/cli/arguments.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/init.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/apps/views/optimization_chart.py"
  • uncovered: "src/inferrsi/apps/workflows/campaign.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.py"
  • uncovered: "src/inferrsi/harness/optimization_session.py"
  • uncovered: "src/inferrsi/harness/project_service.py"
  • uncovered: "src/inferrsi/harness/service_backfill.py"
  • uncovered: "src/inferrsi/harness/service_evidence.py"
  • uncovered: "src/inferrsi/harness/service_observations.py"
  • uncovered: "src/inferrsi/infra/README.md"
  • uncovered: "src/inferrsi/infra/init.py"
  • uncovered: "src/inferrsi/infra/artifacts.py"
  • uncovered: "src/inferrsi/knowledge/_skill_selection.py"
  • uncovered: "src/inferrsi/knowledge/_source_snapshot.py"
  • uncovered: "src/inferrsi/knowledge/catalog.py"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/README.md"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/diffusers/cuda/diffusion/group-offload-transfer-overlap.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/flashattention/cuda/attention/generation-specific-dispatch.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/flashinfer/cuda/llm/paged-decode-dispatch.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/mlx/mlx/execution/cross-stream-dependency.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/mlx/mlx/execution/evaluation-completion.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/mlx/mlx/execution/post-detachment-buffer-lifetime.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/pytorch/cuda/compiler/cudagraph-shapes-and-lifetimes.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/transformers/common/llm/kv-cache-strategy-contracts.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/dependency/triton/common/kernel/bandwidth-fusion-resource-limits.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/peer/cache_dit/common/diffusion/residual-cache-calibration.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/peer/deepinfer/common/llm/bounded-windowed-replay.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/peer/deepinfer/common/llm/speculative-verification-budget.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/peer/deepinfer/common/llm/zero-overhead-deferred-scheduling.json"
  • uncovered: "src/inferrsi/knowledge/data/knowledge_packs/peer/lmdeploy/cuda/llm/kv-quantization-capacity-cost.json"
    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.

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.

2 participants