Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,84 @@

### Changed

- Import `run_session` and its operation-specific requests from `inferrsi.harness.manager`.
The former `inferrsi.harness.optimization_session.session_command` accepted parsed CLI
arguments. Python hosts now pass a request such as `StartProjectSession`,
`EvaluateSessionRound` or `SessionStatus` and supply the same ports as Apps.
For a retained plan, rounds and final assessment, use `manager.read_session_records`
in place of `inferrsi.harness.optimization.read_records`.

- Import parallel round scheduling from `inferrsi.harness.manager`. The former
`inferrsi.harness.parallel_round` operations `prepare`, `submit`, `ticket_status`,
`serve_ticket` and `close_round` map to `prepare_parallel_round`,
`submit_parallel_ticket`, `parallel_ticket_status`, `serve_parallel_ticket` and
`close_parallel_round`. The command-line subcommands and persisted tickets keep their
existing names.

- For native agent sessions, import `prepare_agent_session`, `bind_agent_session`,
`dispatch_agent_session`, `record_agent_session`, `agent_session_status` and
`AGENT_TERMINAL_STATES` from `inferrsi.harness.manager`. They replace `prepare`,
`bind`, `dispatch`, `record`, `status` and `TERMINAL` in `inferrsi.harness.agent_sessions`.
- Import `session_runtime_identity` from `inferrsi.harness.manager` to read the installed
source fingerprint used by ordinary sessions and benchmark comparisons.
- For ordinary projects, import `prepare_project` and `execute_ordinary` from
`inferrsi.harness.executor`. The former `inferrsi.harness.project` operations
`prepare`, `steps`, `inspect_step` and `assess` are now `executor.prepare_project`,
`evaluator.project_steps`, `evaluator.inspect_project_step` and `evaluator.assess_project`.
Use `executor.validate_project` and `executor.PROJECT_DECISIONS` for the former
`project.validate` and `project.DECISIONS`. Import paired statistics and explanation helpers from `inferrsi.harness.evaluator`
in place of `inferrsi.harness.measurement`. Packaged tasks retain their own scoring rules.

- Import `prepare_task_protocol`, `run_task_protocol` and `TaskProtocolError` from
`inferrsi.harness.executor`. They replace `prepare`, `run` and `TaskProtocolError`
in the former `inferrsi.harness.task_protocol` module. Each operation uses the
frozen task resources and the same isolated child process protocol.

- Import `launch_server`, `stop_server`, `post_json` and `ImageProtocol` from
`inferrsi.harness.executor`. This replaces the published
`inferrsi.harness.serving.server` (launch and stop), `inferrsi.harness.serving.http`
(JSON transport) and `inferrsi.harness.serving.image` (image requests) modules.
Managed service callers import `prepare_service` and `execute_service_attempt` from
`inferrsi.harness.executor`, and `service_assessment` and `service_settlement_reason`
from `inferrsi.harness.evaluator`. The former `harness.project_service` and
`harness.service_evidence` modules have been removed.

- Import the four-port AB/BA loop with `from inferrsi.harness.manager import run_experiment`.
The former `inferrsi.harness.runner` module was removed. The `inferrsi run` CLI and
`inferrsi.apps.legacy.run.run_experiment` continue to supply the four port bindings.

- Apps module retirement (0.3.4). Use the [documented replacements](docs/apps-module-migrations.json).
The public evaluation API remains at `inferrsi.apps.api`. See the
[migration instructions](docs/guides/module-layout.md#apps-modules-and-retired-imports) for
script entries, retained pickles and frozen runs.

- Harness storage clients now import `RunStore` and `RunStoreReader` from
`inferrsi.harness.records`. Import `request_digest` from
`inferrsi.harness.executor` and `PublicError`, `PartialExecutionFacts` and
`PUBLIC_ERROR_CODES` from `inferrsi.harness.api`. The former `harness.run_store`,
`harness.execution_spec` and `harness.errors` paths have been removed. Existing
store roots retain their namespace, object references and exact record versions.

- Import `LocalCpuTarget` from `inferrsi.harness.executor`. Its former
`inferrsi.harness.api` entry was removed. Hosts continue to import `Harness`
from `inferrsi.harness.api`.
- Import `prepare_generation`, `read_prepared_binding`, `project_prepared_binding`
and `verify_prepared_binding` from `inferrsi.harness.executor`. These replace
`harness.generation.prepare_generation` and `harness.prepared_binding`'s
`read`, `project` and `verify`. They accept the same specs and artifact readers.
- Hosts execute a prepared spec through `Harness.execute` from `inferrsi.harness.api`.
The former `harness.execution_service`, `harness.entry_code`, `harness.input_binding`
and `harness.evidence_capture` implementations now live inside Executor.
The source modules `candidates`, `confinement`, `skill_evaluation` and `artifact_sandbox`
moved from `inferrsi.harness` to `inferrsi.harness.executor` with their in-tree callers.
- Service recovery uses `process_group_empty` from `inferrsi.harness.executor`.
Local process supervision, launch records and device leases live under
`harness.executor`; the three former root modules were removed.
- The external trial runner moved from `harness.trials.external` to
`harness.executor.trials.external` for apps that inject single-command trials.
- Import `Verdict` and `parse_verdict` from `inferrsi.contracts.claim`.
The former `inferrsi.harness` exports have been removed.

- `inferrsi benchmarks compare` keeps every attempt of an arm (Refs #509, P1.1). The new
`--action retry --trial <id>` opens a fresh attempt with its own job and workspace after a
collected, terminal attempt. The collected attempt stays as evidence, and no campaign is renamed.
Expand Down
7 changes: 3 additions & 4 deletions docs/apps-module-migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@
"src/inferrsi/apps/cli/__init__.py",
"src/inferrsi/apps/views/capture_delivery.py",
"src/inferrsi/apps/views/optimization_story.py",
"src/inferrsi/harness/optimization_session.py",
"tests/repository/check_installed.py",
"tests/fixtures/dashboard_profile_review.py",
"tests/fixtures/knowledge_retrieval.py",
Expand Down Expand Up @@ -591,9 +590,9 @@
"src/inferrsi/apps/delivery/__init__.py",
"src/inferrsi/apps/delivery/projection.py",
"src/inferrsi/apps/delivery/snapshot.py",
"src/inferrsi/harness/artifact_primitives.py",
"src/inferrsi/harness/atomic_json.py",
"src/inferrsi/harness/input_binding.py",
"src/inferrsi/harness/records/artifact_primitives.py",
"src/inferrsi/harness/records/atomic_json.py",
"src/inferrsi/harness/executor/_input_binding.py",
"tests/apps/test_anthropic_agent.py",
"tests/apps/test_goal_checkpoint.py",
"tests/apps/test_inspection.py",
Expand Down
35 changes: 19 additions & 16 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,30 @@ and `apps/workflows/benchmark_operations.py` provide application assembly and la
Each task retains its own protocol and task-specific code.

The [current-Agent optimization session](benchmarks/optimization-benchmarks.md) assembles
the first complete handoff for the Qwen task. `harness/optimization.py` controls
the first complete handoff for the Qwen task. `harness/manager/_state.py` controls
budget, attempts, feedback records, selection and independent final execution.
`harness/task_protocol.py` freezes a supplied resource directory and loads its
task-owned assessment protocol. `harness/optimization_session.py` assembles
execution and assessment; the CLI resolves task resources and injects knowledge
access and the capture callback from `apps/workflows/campaign.py`.
Harness Executor freezes a supplied resource directory with `prepare_task_protocol`
and starts its task-owned protocol in an isolated child with `run_task_protocol`.
The CLI resolves task resources and supplies the task assessor, knowledge access and
capture callback to `harness/manager/_session.py`.
The external Agent chooses and edits candidates between round submissions.
The same controller serves ordinary projects through `campaign start/round/final`
and packaged tasks through `benchmarks session`. The
[shared workflow and sequence diagram](guides/optimization-workflow-unification.md)
describe multi-file candidates, explicit acceptance inputs, stop rules and
dashboard projections from one control record. `harness/project.py` freezes
caller-provided checks and assesses their retained outputs. Ordinary optimization
dashboard projections from one control record. Harness Executor freezes caller-provided
project checks and runs the steps in order. Evaluator inspects each retained step before
execution continues and uses the same rule for the final AB/BA verdict. For packaged
tasks, Evaluator invokes the task assessor supplied by Apps. Ordinary optimization
does not import Benchmark. Benchmark supplies task definitions and specialized
rules, while Harness manages their execution and the complete optimization lifecycle.
Neither infers quality criteria from a natural-language goal.
Ordinary projects default to the current Agent conversation.
The optional [service-reuse protocol](guides/service-reuse-campaigns.md) adds project
assessment and foreground service ownership within this same controller. Its
protocol and result rules live in `harness.project_service`, with process
lifetime managed by `local_process`.
assessment and foreground service ownership within this same controller.
Executor freezes the inputs, owns the foreground service and records stage receipts.
Evaluator checks the receipts and decides the next stage or formal verdict. Candidate
checkpoints retain that verdict before profiling and service cleanup.
The [experimental speculative search](guides/speculative-search.md) composes immutable
candidate trees, bounded completion menus, synchronous VATS and CPU GVO roles.
Its work controller uses shared RunStore transactions and the existing local
Expand All @@ -44,7 +47,7 @@ tool and retain the native identity and returned artifacts. The child owns the
complete start/knowledge/round/final lifecycle; the parent observes and collects. This path records the handoff; it
does not implement a background Agent CLI driver or a native-host deadline.

The application injects `harness.trials.external.execute_trial` into the
The application injects `harness.executor.trials.external.execute_trial` into the
[two-rank MoE entry](benchmarks/moe-forward-benchmark.md). The standalone image benchmark
and [TTS service protocol](benchmarks/tts-benchmark.md) expose their documented execution
boundaries. Apps and Harness callers assemble these operations into optimization
Expand Down Expand Up @@ -284,7 +287,7 @@ the [import gate](guides/module-layout.md#import-gate) for migration and depende

| Add | Main extension locations | Required qualification |
| --- | --- | --- |
| Model or scenario | `harness/serving`, `benchmark/metrics.py`, `benchmark/validators`; trials run through the model-independent `harness/trials/external.py` | Frozen request and metric contract; model-specific quality coverage |
| Model or scenario | `harness/executor/serving`, `benchmark/metrics.py`, `benchmark/validators`; trials run through the model-independent `harness/executor/trials/external.py` | Frozen request and metric contract; model-specific quality coverage |
| Repository | `apps/host/targets`, a composed scenario, `resources/repo_packs` | Stable source identity; command/result contract; environment isolation |
| Hardware | `apps/host/platforms` | Device selection, process exclusivity and independent backend/model evidence; a backend is registered in `apps/host/platforms/__init__.py` and its probe command is defined in the implementing module under `apps/host/platforms/`, not in package data |

Expand All @@ -298,7 +301,7 @@ synthetic contract fixtures, not accelerator measurements.

`apps.legacy.run.run_experiment(spec, environment, *, execute, snapshot)` composes
the old run and accepts small callable adapters. It passes them, the Benchmark v0
gates and the report to `harness.runner.run_experiment`, whose four ports
gates and the report to `harness.manager.run_experiment`, whose four ports
(`execute`, `snapshot`, `assess`, `report`) have no defaults. An omitted
`execute` or `snapshot` is read from `apps.legacy.run` when the run starts
(`execute_trial` and `repository_identity`), which is the two-argument call
Expand Down Expand Up @@ -332,7 +335,7 @@ float; `benchmark.legacy_run_v0.trial_metric` then applies the one finite, posit
metric contract (`benchmark.metrics.validate_metric`) to whatever the reader
returns, so a reader that yields `0.0`, a `bool` or a non-finite value records a
metric error rather than entering the evaluation. The Harness executor
`harness.trials.external.execute_trial` holds no metric rule: a caller that
`harness.executor.trials.external.execute_trial` holds no metric rule: a caller that
passes a metric key also passes `metric=`, its validation function.

Run state is written by the termination path, never assumed. `status.json`
Expand Down Expand Up @@ -380,12 +383,12 @@ change the AB/BA algorithm, process cleanup or evaluator.

## Compatibility and historical evidence

The supervised server helpers (`harness.serving.server.launch_server` / `stop_server`)
The supervised server helpers `launch_server` and `stop_server` in `inferrsi.harness.executor`
require Linux with a readable `/proc` process table. They reject other platforms
before launch; missing or inaccessible process enumeration raises an error rather
than reporting successful cleanup. Workers must remain in their owned process
group. Windows Job Object support in the general command executor
(`harness.local_process`) does not extend to these server helpers. These constraints do not restrict read-only knowledge
(`harness.executor.local_process`) does not extend to these server helpers. These constraints do not restrict read-only knowledge
operations or the control CLI to Linux.

- Existing CLI flags, external JSON metrics, run artifacts, cancellation
Expand Down
4 changes: 2 additions & 2 deletions docs/assets/modular-directory-map-en.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/benchmarks/moe-forward-benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ inferrsi benchmarks run moe-forward-npu \
`--timeout-seconds` 都必须显式指定;两组配对为每实现每性能 case 16 个计时样本,
四组为 32 个。超时包括入口准备和执行,之后最多有额外的有界进程清理等待。
入口先冻结题目、候选和 grader 的副本及 SHA256,再通过现有
由应用入口注入的 `harness.trials.external.execute_trial` 执行。
由应用入口注入的 `harness.executor.trials.external.execute_trial` 执行。
该执行器不含 metric 规则,入口在传 metric key 的同时传入自己的校验函数
(`metric=read_metric`)。
Python 调用 `evaluate` 时须显式传入 `execute_trial`。它额外清理本次唯一环境标记的
Expand Down
2 changes: 1 addition & 1 deletion docs/contracts/current-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The corpus lives in `knowledge/data/skill_library/`. Target repository descripto
Decision: see [`function-owners.md`](function-owners.md). Target new core layout:

- K keeps the seven original file names.
- H: `api.py`, `execution_service.py`, `input_binding.py`, `run_store.py`, `budget.py`, `resources.py`, `records/*`.
- H: `api/`, `execution_service.py`, `input_binding.py`, `budget.py`, `resources.py`, `records/*`.
- B: `api.py`, `evaluation.py`, `legacy_run_v0.py`, `sampling.py`, `tasks/*`, `workers/*`, `validators/*`.
- Apps: `bridge.py`, `archive.py`, `result.py`, and `views/legacy`.

Expand Down
Loading
Loading