Skip to content
Open
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
[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.

- `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
4 changes: 2 additions & 2 deletions docs/apps-module-migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,8 @@
"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/records/artifact_primitives.py",
"src/inferrsi/harness/records/atomic_json.py",
"src/inferrsi/harness/input_binding.py",
"tests/apps/test_anthropic_agent.py",
"tests/apps/test_goal_checkpoint.py",
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
2 changes: 1 addition & 1 deletion docs/contracts/function-owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ Any later split of a mixed function is accepted by real pytest/host/wheel/record

The skill-evaluation split (#410) implements the `skill_evaluation`, `skill_eval_diagnostic`, `skill_eval_engineering` and `improvement` rows. H keeps `harness/skill_evaluation.py`, `harness/artifact_sandbox.py` and `harness/manager/search/improvement.py`; B holds `benchmark/skill_evaluation.py`, `benchmark/skill_eval_diagnostic.py`, `benchmark/skill_eval_engineering.py` and `benchmark/improvement.py`; Apps composes them in `apps/workflows/skill_evaluation.py`, `apps/workflows/skill_eval_engineering.py` and `apps/workflows/improvement.py`. Two points follow the tree as it stands after #338, not the row text:

- `usage_totals` stays in `harness/usage.py`, because `harness/optimization.py` consumes it for budget accounting. B `assessment` receives the baseline and candidate totals from Apps and does not import H.
- `usage_totals` stays in `harness/records/usage.py`, because `harness/optimization.py` consumes it for budget accounting. B `assessment` receives the baseline and candidate totals from Apps and does not import H.
- `SelectionPolicy` holds only the two thresholds, so it lives whole in B. H `choose` receives the assessments, the validity block and the composition flag; it holds no threshold and no policy class.
9 changes: 5 additions & 4 deletions docs/guides/apps-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ error. A consumer must use an authorized storage reader and verify the bytes,
size and digest before treating a referenced artifact as evidence. Validating
the result.json digest does not validate all referenced artifacts.

The Apps design decision selects `inferrsi.harness.execution_spec.request_digest`
as the public Harness digest entry point. `inferrsi.harness.run_store.request_digest`
remains a compatibility export of the same function. Apps can compute the
canonical digest without loading the RunStore implementation.
Use `from inferrsi.harness.executor import request_digest` to compute the
canonical digest of a complete execution request. The import loads only the
canonical encoder and its package dependencies. Callers of the former
`inferrsi.harness.execution_spec.request_digest` and
`inferrsi.harness.run_store.request_digest` entries should use this import.

## Prepare archive

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/harness-improvement.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ flowchart TB

`src/inferrsi/benchmark/improvement.py` owns the thresholds and acceptance rules,
`src/inferrsi/harness/manager/search/improvement.py` the search progression and
`src/inferrsi/harness/usage.py` usage accounting; `src/inferrsi/apps/workflows/improvement.py`
`src/inferrsi/harness/records/usage.py` usage accounting; `src/inferrsi/apps/workflows/improvement.py`
composes them.
`tools/skill_eval_improve.py` owns freezing, declarative snapshot materialization
and orchestration through `tools/skill_eval_compare.py`. There is no second
Expand Down
15 changes: 11 additions & 4 deletions docs/guides/module-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ into runs by file path.

### Core and technical packages

Use `inferrsi.harness.executor.request_digest` for the execution request's
semantic ID. Mount an existing store with `RunStore` or `RunStoreReader` from
`inferrsi.harness.records`, using the original root and namespace. A read by
the recorded version returns that version's original bytes. Catch `PublicError`
from `inferrsi.harness.api` for both store and execution operations. For ordinary
optimization sessions, status and recovery still require the frozen runtime.

The four target modules are peers: `knowledge`, `harness`, `benchmark`, and
`apps`. Knowledge, Harness, and Benchmark do not import one another. Apps is
the only assembler. `src/inferrsi/contracts/__init__.py` re-exports only
Expand Down Expand Up @@ -246,8 +253,8 @@ the `temporary leaf importers` blocker that R1 left for root `arguments.py`. R2
cleared `harness reaches model/infra` (12 hits): `agent_sessions`, `candidates`,
`optimization`, `optimization_session`, `project` and `task_protocol` each reached
`inferrsi.infra` and `inferrsi.infra.artifacts`. They now take `digest`, `sha256`
and `file_lock` from `harness/artifact_primitives.py` and `atomic_write_json` from
`harness/atomic_json.py`, whose function bodies equal those in `infra/artifacts.py`.
and `file_lock` from `harness/records/artifact_primitives.py` and `atomic_write_json` from
`harness/records/atomic_json.py`, whose function bodies equal those in `infra/artifacts.py`.
`infra/artifacts.py` stayed for its other users until #498 removed `infra/`. No Harness module reaches
`inferrsi.infra` or `inferrsi.model`. R3 cleared `runtime resource loaders: 5`.

Expand Down Expand Up @@ -336,7 +343,7 @@ The leaf's own import rule and `REPO_TYPES` object identity govern it.
`inferrsi.harness.manager` and `inferrsi.harness.executor`. The gate also
tracks `inferrsi.harness.api`, `inferrsi.harness.execution_service`,
`inferrsi.harness.input_binding`, `inferrsi.harness.local_process`,
`inferrsi.harness.run_store`, and `inferrsi.harness.errors`. Each registered
`inferrsi.harness.records`, its `_run_store` backend and `inferrsi.contracts._harness_errors`. Each registered
entry must appear in the import graph and satisfy its dependency rules.
The closure rule above applies to every Harness module. The gate rejects
imports of the former root-level runner and ten search modules, and any
Expand All @@ -349,7 +356,7 @@ The leaf's own import rule and `REPO_TYPES` object identity govern it.
root leaf fails, and so does each harness module that reaches the leaf
through it. The report lists every remaining `harness` → Model or Infra
path in `harness_model_infra`; the split modules `harness.skill_evaluation`,
`harness.manager.search.improvement`, `harness.artifact_sandbox` and `harness.atomic_json`
`harness.manager.search.improvement`, `harness.artifact_sandbox` and `harness.records.atomic_json`
have none.

The manifest records the base commit, each old leaf's file hash at that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"patch/README.md": "e2a3af7bd373d9e1637265f3980fd272cbbc181d455d275794bf66f2cc6f8095",
"plan/edits.json": "2975fee42370debd80f627ecd58880e45280968f739ca3045c8b388bc9ab4cbb",
"plan/plan.json": "66344b1ca1522fd3b38966c243bbb6ec8eb8fecc203ccd171690463569632013",
"plan/run.py": "e16382292afc735615c1f21c230aaa4054c68613d084f4a75c61e04295af0d74",
"plan/run.py": "4222d9944a02ee6b7a79d314749f73b8d9421ff0a8d95d6c680ce426fb44a533",
"plan/runspec.json": "f3f2ab71d227ee3e7d95233cc3d34e17ab41d086f519f558fb3aca5200515404",
"results/local-archive.json": "c5df5dc55feb202e53f28d5b6f4ba28913e893277d9deb5e783a472c686d9ae6",
"results/summary.json": "df3029cfcaacb91018b6c931017b059b99a80633116586f9446fe82e31986132",
"results/trials.jsonl": "6bd39719a5c0d794b1c5e04403b03789ae5ca42e0c9c74694200bdb6355a0756",
"validator/README.md": "c224e3d864829d5c1a2f8bc4e4c89e36834409d4ce78fc1fa7dc59f6f739fdd3",
"validator/check.py": "6cd0948acf82c6870ac29c2188ede2092dca83e64e73aea2224edeb2f9187e2b"
"validator/check.py": "61c274e036ec8167ddb18f9d102f4116a74e308a526f2ff4642bcd891a2d309c"
}
6 changes: 3 additions & 3 deletions evidence/qwen-vats-gvo-910b1-20261124/plan/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

from inferrsi.apps.workflows.search_benchmarks import EngineEvaluator
from inferrsi.apps.workflows.search_roles import Snapshot
from inferrsi.harness.artifact_primitives import digest, sha256
from inferrsi.harness.atomic_json import atomic_write_json
from inferrsi.harness.manager.search import search_tree
from inferrsi.harness.manager.search.search_adapter import ArtifactAdapter, Edit
from inferrsi.harness.manager.search.search_campaign import (
Expand All @@ -24,7 +22,9 @@
from inferrsi.harness.manager.search.search_records import decode
from inferrsi.harness.manager.search.vats import Search, Settings
from inferrsi.harness.manager.search.work_control import WorkControl
from inferrsi.harness.run_store import RunStore
from inferrsi.harness.records import RunStore
from inferrsi.harness.records.artifact_primitives import digest, sha256
from inferrsi.harness.records.atomic_json import atomic_write_json

HERE = Path(__file__).resolve().parent

Expand Down
2 changes: 1 addition & 1 deletion evidence/qwen-vats-gvo-910b1-20261124/validator/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from inferrsi.benchmark.registry import task_resources
from inferrsi.harness import candidates, task_protocol
from inferrsi.harness.manager.search.work_control import WorkControl
from inferrsi.harness.run_store import RunStoreReader
from inferrsi.harness.records import RunStoreReader

PLAN = Path(__file__).resolve().parents[1] / "plan"
PRE_MIGRATION_DRIVER_SHA256 = "8c66690aa9bb7b53dcbfe568bfe3654a65436a11ee7a05b21c2d3c0d611e1ad5"
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _optimization_session(args, *, task_source=None, report_metadata=None):


def _fixed_attempt_command(args) -> int:
from ...harness.errors import PublicError
from ...harness.api import PublicError
from ..api import read_attempt_view

if args.storage_config is None:
Expand Down
4 changes: 2 additions & 2 deletions src/inferrsi/apps/cli/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _prepare_ports(config: dict) -> dict:

def _execute_ports(config: dict, storage: dict, *, capture_evidence: bool = False) -> dict:
from ...harness.api import Harness, LocalCpuTarget
from ...harness.run_store import RunStore
from ...harness.records import RunStore
from ..storage.artifact_reader import ArtifactReader

target = config.get("target")
Expand Down Expand Up @@ -167,7 +167,7 @@ def _check_options(args, request: dict, storage: dict) -> None:

def dispatch(args) -> int:
"""Print the same result as Python, including committed refs on publication failure."""
from ...harness.errors import PublicError
from ...harness.api import PublicError
from .. import api
from ..storage.archive import validate_output_id

Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/delivery/benchmark_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ...benchmark.summary import POLICY, supported_policy, token_usage
from ...harness import agent_sessions
from ...harness.usage import normalize_usage
from ...harness.records.usage import normalize_usage
from .schema import number
from .snapshot import Snapshot, SnapshotChanged

Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/delivery/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import re

from ...harness.usage import normalize_usage
from ...harness.records.usage import normalize_usage
from ..storage.artifacts import digest
from .schema import gap, number, timestamp

Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/handoff/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hashlib import sha256

from inferrsi.contracts.json_v1 import decode, encode
from inferrsi.harness.errors import PublicError
from inferrsi.harness.api import PublicError

from ..storage.archive import _logical_path
from ..storage.result import validate_artifact_ref
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/handoff/candidate_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hashlib import sha256

from inferrsi.contracts.json_v1 import decode, encode
from inferrsi.harness.errors import PublicError
from inferrsi.harness.api import PublicError

from ..storage.archive import _logical_path
from ..storage.artifact_reader import ArtifactReader
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/handoff/evidence_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from copy import deepcopy
from hashlib import sha256

from inferrsi.harness.errors import PublicError
from inferrsi.harness.api import PublicError

from ..storage.result import validate_artifact_ref

Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/handoff/production_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from copy import deepcopy

from ...harness.errors import PublicError
from ...harness.api import PublicError
from ..storage.archive import read_prepared
from ..storage.artifact_reader import ArtifactReader
from .evidence_capture import EvidenceCapture
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/storage/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from uuid import uuid4

from inferrsi.contracts.json_v1 import decode, encode
from inferrsi.harness.errors import PublicError
from inferrsi.harness.api import PublicError

from .result import publication_error, validate_artifact_ref, validate_result

Expand Down
4 changes: 2 additions & 2 deletions src/inferrsi/apps/storage/artifact_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from io import BytesIO

from inferrsi.contracts.json_v1 import encode
from inferrsi.harness.errors import PublicError
from inferrsi.harness.api import PublicError

from .archive import _logical_path, _read_directory_artifact, _storage_mounts
from .result import validate_artifact_ref
Expand Down Expand Up @@ -45,7 +45,7 @@ def open(self, ref: dict) -> BytesIO:
if kind == "directory":
return BytesIO(_read_directory_artifact(prefix, root, ref, stage="open"))
# Archive-only consumers never load the SQLite implementation.
from inferrsi.harness.run_store import RunStoreReader
from inferrsi.harness.records import RunStoreReader

return RunStoreReader.from_mount({
"prefix": prefix, "kind": kind, "root": str(root), "namespace": namespace,
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/storage/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hashlib import sha256

from inferrsi.contracts.json_v1 import encode
from inferrsi.harness.errors import PUBLIC_ERROR_CODES, PartialExecutionFacts
from inferrsi.harness.api import PUBLIC_ERROR_CODES, PartialExecutionFacts

_EXIT_CODES = {
"success": 0,
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/views/attempt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from copy import deepcopy

from inferrsi.contracts.json_v1 import decode
from inferrsi.harness.errors import PublicError
from inferrsi.harness.api import PublicError

from ..handoff.bridge import check_assessment_identity
from ..storage.archive import read_assessment
Expand Down
4 changes: 2 additions & 2 deletions src/inferrsi/apps/workflows/benchmark_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
from inferrsi.benchmark.summary import POLICY, supported_policy
from inferrsi.benchmark.summary import comparison as metrics_comparison
from inferrsi.harness import agent_sessions, optimization
from inferrsi.harness.artifact_primitives import digest, file_lock, sha256
from inferrsi.harness.atomic_json import atomic_write_json
from inferrsi.harness.optimization_session import _runtime_identity
from inferrsi.harness.records.artifact_primitives import digest, file_lock, sha256
from inferrsi.harness.records.atomic_json import atomic_write_json
from inferrsi.harness.records.knowledge_capture import verify_capture
from inferrsi.harness.task_protocol import run as protocol_operation
from inferrsi.knowledge.catalog import SCENARIO_ALIASES
Expand Down
4 changes: 2 additions & 2 deletions src/inferrsi/apps/workflows/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from pathlib import Path

from inferrsi.contracts.json_v1 import decode, encode
from inferrsi.harness.errors import PublicError
from inferrsi.harness.execution_spec import request_digest
from inferrsi.harness.api import PublicError
from inferrsi.harness.executor import request_digest

from ..handoff.bridge import bind_execution as _bind_prepared_execution
from ..handoff.bridge import (
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/workflows/improvement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from inferrsi.benchmark import improvement as rules
from inferrsi.benchmark.improvement import SelectionPolicy
from inferrsi.harness.manager.search import improvement as progression
from inferrsi.harness.usage import usage_totals
from inferrsi.harness.records.usage import usage_totals


def assessment(report: dict, policy: SelectionPolicy) -> dict:
Expand Down
4 changes: 2 additions & 2 deletions src/inferrsi/apps/workflows/search_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from inferrsi.benchmark.improvement import SelectionPolicy, holdout_accepts
from inferrsi.benchmark.registry import task_resources
from inferrsi.harness import candidates, task_protocol
from inferrsi.harness.artifact_primitives import digest, sha256
from inferrsi.harness.atomic_json import atomic_write_json
from inferrsi.harness.executor import runtime_environment
from inferrsi.harness.records.artifact_primitives import digest, sha256
from inferrsi.harness.records.atomic_json import atomic_write_json
from inferrsi.harness.trials.external import execute_trial


Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/workflows/skill_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from inferrsi.benchmark import skill_eval_engineering as engineering_task
from inferrsi.benchmark import skill_evaluation as rules
from inferrsi.harness import skill_evaluation as host
from inferrsi.harness.usage import normalize_usage
from inferrsi.harness.records.usage import normalize_usage
from inferrsi.knowledge.knowledge_operations import KnowledgeReader

from . import skill_eval_engineering
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/workflows/speculative_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import json

from inferrsi.apps.workflows.search_roles import Snapshot
from inferrsi.harness.atomic_json import atomic_write_json
from inferrsi.harness.manager import EngineSearchPlan, read_engine_search, run_engine_search
from inferrsi.harness.records.atomic_json import atomic_write_json


def command(args):
Expand Down
7 changes: 5 additions & 2 deletions src/inferrsi/harness/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ measurement and assessment rules.

## Entry points

- [`api.py`](api.py) exposes `Harness.allocate`, `execute`, and `read` for local
- [the public API](api/__init__.py) exposes `Harness.allocate`, `execute`, and `read` for local
CPU commands. [`local_process.py`](local_process.py) owns the process domain.
- [`run_store.py`](run_store.py) provides `RunStore` and `RunStoreReader` for
- [Records](records/__init__.py) provides `RunStore` and `RunStoreReader` for
namespaced records and content-addressed artifacts. Pass `record_version`
to read a fixed record and use `open(ref)` to read retained artifact bytes.
The [service observation reader](records/service_observations.py) reconstructs settled
rounds, including older embedded profiles. Service readers and writers share the
[path, JSON and diagnostic limits](records/service_io.py).
- [`optimization_session.py`](optimization_session.py) connects session
commands to the budget and recovery logic in [`optimization.py`](optimization.py).
[`task_protocol.py`](task_protocol.py) prepares task protocol packages and runs
Expand Down
6 changes: 3 additions & 3 deletions src/inferrsi/harness/agent_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import uuid
from pathlib import Path

from .artifact_primitives import digest, file_lock, sha256
from .atomic_json import atomic_write_json
from .usage import normalize_usage
from .records.artifact_primitives import digest, file_lock, sha256
from .records.atomic_json import atomic_write_json
from .records.usage import normalize_usage

TERMINAL = {"completed", "failed", "cancelled"}
OBSERVED_STATES = {"running", "needs_attention", *TERMINAL}
Expand Down
23 changes: 23 additions & 0 deletions src/inferrsi/harness/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Public Harness execution ports and their shared error types."""

from inferrsi.contracts._harness_errors import (
PUBLIC_ERROR_CODES,
PartialExecutionFacts,
PublicError,
)

__all__ = [
"PUBLIC_ERROR_CODES", "Harness", "LocalCpuTarget", "PartialExecutionFacts", "PublicError",
]


def __getattr__(name):
if name == "Harness":
from ._harness import Harness

return Harness
if name == "LocalCpuTarget":
from inferrsi.harness.execution_service import LocalCpuTarget

return LocalCpuTarget
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Loading
Loading