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
6 changes: 4 additions & 2 deletions .github/workflows/ci-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
test -f docs/contributing.md
test -f README.md
test -d src/inferrsi/harness
test -d src/inferrsi/model
test -d src/inferrsi/infra
test -d src/inferrsi/apps/host
test -d src/inferrsi/apps/integrations/anthropic
test ! -e src/inferrsi/model
test ! -e src/inferrsi/infra
test -d evidence/_template/plan
- uses: actions/setup-python@v5
with:
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/ci-ready.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@ jobs:
if counts != {"tests": len(nodes), "errors": 0, "failures": 0, "skipped": 0}:
raise SystemExit("every selected host node must run and pass")
- name: Test the Harness artifact-primitive and writer nodes on Windows
# #412 R2: Harness owns copies of the Infra digest, hash, file lock and atomic
# writer. On Windows the lock is an msvcrt byte range that even denies a read of
# the locked byte, which no Linux job can show. macOS uses the same fcntl lock as
# the Linux jobs, so only Windows runs these nodes. Runs even if the step above
# failed, so both results are recorded.
# #412 R2: Harness owns copies of the digest, hash, file lock and atomic writer.
# #498 slices 3b and 5 gave Apps and Benchmark their own copies and removed Infra,
# so these nodes now compare the Harness copy with the Apps copy. On Windows the
# lock is an msvcrt byte range that even denies a read of the locked byte, which no
# Linux job can show. macOS uses the same fcntl lock as the Linux jobs, so only
# Windows runs these nodes. Runs even if the step above failed, so both results are
# recorded.
if: ${{ !cancelled() && runner.os == 'Windows' }}
shell: python
env:
Expand All @@ -196,12 +198,13 @@ jobs:
import xml.etree.ElementTree as ET

nodes = [
"tests/test_skill_evaluation.py::test_harness_artifact_primitives_match_infra_bytes_and_semantics",
"tests/test_skill_evaluation.py::test_harness_owned_writes_and_digests_match_infra_bytes",
"tests/test_legacy_run_split.py::test_harness_writer_bytes_equal_the_infra_writer",
"tests/test_skill_evaluation.py::test_harness_artifact_primitives_match_apps_bytes_and_semantics",
"tests/test_skill_evaluation.py::test_harness_owned_writes_and_digests_match_apps_bytes",
"tests/test_legacy_run_split.py::test_harness_writer_bytes_equal_the_apps_writer",
"tests/test_legacy_run_split.py::test_harness_writer_rejects_nan_and_leaves_no_file",
"tests/test_legacy_run_split.py::test_sampling_sha256_matches_the_infra_hasher",
"tests/test_legacy_run_split.py::test_sampling_sha256_matches_the_apps_hasher",
"tests/test_optimization_session.py::test_runtime_identity_covers_migrated_process_domain_and_not_removed_executor",
"tests/test_session_lock_across_processes.py",
"tests/test_agent_sessions.py",
]
results = os.environ["RESULTS"]
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@

### Changed

- The `inferrsi.infra` and `inferrsi.model` packages are removed (Refs #498, slices 3b, 4
and 5). There is no forwarding module or alias, and the import gate fails any import of
either package name, with or without a file behind it.
- `inferrsi.infra.artifacts` is now `inferrsi.apps.artifacts`. Apps owns this copy with
the same function source as the Harness and Benchmark copies, and
`tests/test_artifact_helper_copies.py` keeps the three equal. `apps/delivery/`, the
tools, the examples and the tests import it. The Apps copy and `harness/artifact_primitives.py`
use the same `.session.lock` file lock, so a Harness writer and an Apps export exclude
each other across processes.
- `inferrsi.model.anthropic_agent`, `anthropic_edit_agent` and `request_guard` are now
`inferrsi.apps.integrations.anthropic.*`. Only the two path-valued `SOURCE` constants
changed. `tools/skill_eval_compare.py` hashes the new files as controllers, so a new
comparison plan binds them; an existing plan keeps its recorded identities. The
Messages worker still loads its adjacent `request_guard.py` by file location.
- The optimization session's runtime identity no longer hashes `infra/artifacts.py`.
A session planned before this change is refused before `status`, `recover` or any other
operation runs, and its plan is not changed. Resume such a session with the runtime that
planned it, as for the serving move.
- The package now holds exactly `apps`, `benchmark`, `contracts`, `harness`, `knowledge`
and `resources`. `tests/test_package_root_inventory.py` fails a returning `infra/` or
`model/`, a new sibling package and a missing one.
- The Windows host job now compares the Harness copy with the Apps copy and runs the
cross-process lock test.
- Apps workflow implementations now live in `apps/workflows/`: campaign capture,
task launching, paired benchmark comparison, improvement and skill evaluation.
The previous Apps imports retain explicit compatibility exports. New optimization
Expand Down
13 changes: 8 additions & 5 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ interfaces; existing CLI commands remain supported.
| Entry and knowledge | CLI arguments, immutable RunSpec, cited knowledge/context export | Model execution or automatic source editing |
| Harness | AB/BA order, deadlines, source checks, scenario composition, evidence, performance adjudication and reporting | Device-specific conditions, request schemas or kernel dispatch |
| Model | Anthropic provider adapters and their request authorization | Scheduling, worker lifetime, hardware selection, request payloads, metric contracts or quality checks |
| Infra | Repository identity, device discovery/qualification, storage and artifacts | Model constants, campaign gates or performance verdicts |
| Apps | CLI, host bindings (source identity, device discovery/qualification, environment facts), artifact digests and JSON writes, provider integrations | Model constants, campaign gates or performance verdicts |

Dependencies flow from entrypoints to Harness. Harness reaches no Infra or Model
module, and Infra does not import Model or Harness. None
Dependencies flow from entrypoints to Harness. #498 removed the Infra and Model
packages, so Harness reaches neither. None
of these shared packages imports a campaign from `examples/`.

Environment inspection follows that direction. `apps/host/inspection.py` is the
Expand Down Expand Up @@ -279,8 +279,11 @@ src/inferrsi/
server.py Supervised Linux serving workers and their group cleanup
http.py Timed JSON POST transport
image.py OpenAI-style image payload and PNG response protocol
infra/
artifacts.py Hashing and evidence writes
artifacts.py Apps-owned hashing, file lock and evidence writes
integrations/anthropic/
anthropic_agent.py Bounded direct Messages agent with frozen cost reservations
anthropic_edit_agent.py Bounded edit-and-check protocol
request_guard.py Request authorization broker, loaded by file location
data/
repo_packs/ Contribution descriptors and versioned tuning knowledge
knowledge_packs/ Dependency and peer knowledge, preserving existing tiers
Expand Down
2 changes: 1 addition & 1 deletion docs/local-skill-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ without silently changing its contract:

```python
from inferrsi.benchmark.skill_eval_engineering import REQUEST
from inferrsi.infra.artifacts import write_json
from inferrsi.apps.artifacts import write_json

write_json("cases.json", [{
"id": "serving-response-v1", "split": "development",
Expand Down
3 changes: 2 additions & 1 deletion docs/module-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ Several flat modules remain shared seams until their slice starts.
| `benchmark/metrics.py`, `benchmark/validators/`, `benchmark/artifacts.py` | The metric contract, the Flare and image quality checks, and Benchmark's own file digests and JSON writes | #498 slice 1 moved the first two from `model/protocols/metrics.py` and `model/validators/`, with no forwarder or alias; the gate fails any import of the old paths |
| `harness/serving/` (`server.py`, `http.py`, `image.py`) | Supervised serving processes, the timed JSON transport and the image request client | #498 slice 2 moved them from `infra/processes.py`, `infra/http.py` and `model/protocols/image.py` with no forwarder or alias; the initializer imports nothing, and the gate fails any import of the old paths |
| `apps/host/` (`inspection.py`, `commands.py`, `environment.py`, `platforms/`, `targets/`) | The host environment facts API, bounded probes, dependency facts, device discovery and source identity | #498 slice 3a moved them from Infra with no forwarder or alias; the package keeps Infra's limit and reaches no Knowledge, Harness or Benchmark module; `inspection.py` is the permanent leaf importer |
| `infra/` | `artifacts.py`, the shared file digests and JSON writes, until #498 slice 5 | Not a fourth core; reaches no Knowledge, Harness, Benchmark or Apps module |
| `apps/artifacts.py` | Apps's own file digests, file lock and JSON evidence writes | #498 slices 3b and 5 gave Apps this copy and deleted `infra/`; `tests/test_artifact_helper_copies.py` keeps it equal to the Harness and Benchmark copies |
| `apps/integrations/anthropic/` (`anthropic_agent.py`, `anthropic_edit_agent.py`, `request_guard.py`) | The bounded Anthropic Messages agent, its edit-and-check protocol and the request authorization broker | #498 slice 4 moved them from `model/` with no forwarder or alias; only the path-valued `SOURCE` constants changed. The worker loads `request_guard.py` by file location, so it must ship next to the agent |
| `apps/views/summary_chart.py` | Stdlib SVG gain chart and report figure spec | A2 (#408) moved root `summary_chart.py` here; the renderer, its specification checks and its `main` are unchanged, and `tools/campaign_summary_chart.py` calls it |
| `contracts/` (`runspec.py`, `json_v1.py`, `claim.py`, `evidence.py`) | Technical-only contracts: RunSpec, canonical JSON, verdict vocabulary, evidence segment and path rules | Exact module set; the initializer re-exports only `RunSpec`; not a fourth core |
| `apps/storage/evidence_layout.py` | Evidence directory creation over the `contracts/evidence.py` path rules | The `mkdir` half of former root `evidence_paths.py`; host I/O stays in Apps |
Expand Down
4 changes: 2 additions & 2 deletions examples/qwen21_turbo_b300.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Frozen 720p-class Qwen-Image-2.1-Turbo online B300 campaign.

Uses the stdlib InferRSI infrastructure package for source/device/process
Uses the stdlib InferRSI host, serving and artifact modules for source/device/process
ownership. New campaigns must freeze fresh helper hashes and references.
"""
import argparse
Expand All @@ -22,7 +22,7 @@
from inferrsi.harness.serving.server import launch_server, stop_server
from inferrsi.apps.host import environment, targets
from inferrsi.apps.host.platforms.cuda import qualify_devices
from inferrsi.infra import artifacts
from inferrsi.apps import artifacts

MODEL = "Qwen/Qwen-Image-2.1-Turbo"
REVISION = "d65dbc9a7e8f6b5479e33dee6030eaab2a906509"
Expand Down
2 changes: 1 addition & 1 deletion examples/qwen21_turbo_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
import sys

from inferrsi.infra import artifacts as lifecycle
from inferrsi.apps import artifacts as lifecycle


def load(path):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Deterministic digests and JSON evidence, without model dependencies."""
# Apps-owned file digests, file locks and JSON evidence writes. The function bodies equal
# those in the other cores' copies; tests/test_artifact_helper_copies.py keeps them equal.
# Apps imports no other inferrsi module here.

import hashlib
import json
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/delivery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from tempfile import TemporaryDirectory

from ... import __version__
from ...infra.artifacts import file_lock
from ..artifacts import file_lock
from ..storage import archive
from . import adapters
from .projection import iterative
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 @@ -3,7 +3,7 @@
import re

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


Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/apps/delivery/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path, PurePosixPath

from ...harness import candidates
from ...infra.artifacts import sha256
from ..artifacts import sha256
from .schema import decode

MAX_DOCUMENT_BYTES = 8 * 1024 * 1024
Expand Down
1 change: 1 addition & 0 deletions src/inferrsi/apps/integrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Apps integrations with external systems. The initializer imports nothing."""
4 changes: 4 additions & 0 deletions src/inferrsi/apps/integrations/anthropic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Anthropic provider adapters and their request authorization.

The initializer imports nothing.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
EDIT_KIND = "anthropic-messages-edit-check-v1"
FULL_CONTEXT_MAX_REQUEST = 262144
ENDPOINT = "https://yibuapi.com/v1/messages"
SOURCE = "src/inferrsi/model/anthropic_agent.py"
SOURCE = "src/inferrsi/apps/integrations/anthropic/anthropic_agent.py"
MAX_RESPONSE = 1024 * 1024
# Full context bound from https://platform.claude.com/docs/en/models/opus-5-5/overview
MODEL_CONTEXT = {"claude-opus-5-5": 1000000}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from contextlib import contextmanager
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

SOURCE = "src/inferrsi/model/request_guard.py"
SOURCE = "src/inferrsi/apps/integrations/anthropic/request_guard.py"
ENV_KEYS = ("SKILL_EVAL_GATE_PORT", "SKILL_EVAL_GATE_TOKEN", "SKILL_EVAL_GATE_CONTEXT")


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

``RunSpec`` is the only name this initializer re-exports. Import the canonical
encoder from ``contracts.json_v1`` and the verdict types from ``contracts.claim``.
No module here imports a core, Apps, Infra or Model module, or does I/O on import.
No module here imports a core or Apps module, or does I/O on import.
"""

from .runspec import RunSpec
Expand Down
5 changes: 3 additions & 2 deletions src/inferrsi/harness/artifact_primitives.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Harness-owned digest, file hash and file lock. Each function body equals the one in
# infra.artifacts, so digests, hashes and lock files are byte-identical and the two locks
# exclude each other on the same path; Harness does not import that module here.
# inferrsi.apps.artifacts, so digests, hashes and lock files are byte-identical and the two
# locks exclude each other on the same path; Harness does not import that module here.
# tests/test_artifact_helper_copies.py keeps the copies equal.

import hashlib
import json
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/harness/atomic_json.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Harness-owned atomic JSON evidence writes. The bytes equal those written by
# infra.artifacts.atomic_write_json; Harness does not import that module here.
# inferrsi.apps.artifacts.atomic_write_json; Harness does not import that module here.

import json
import os
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/harness/input_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import BinaryIO

# H input capture and byte-equivalent copies. H owns these digests and writes and never
# imports infra.artifacts. A source is read once into a snapshot; every later copy comes
# imports inferrsi.apps.artifacts. A source is read once into a snapshot; every later copy comes
# from that snapshot, never again from the mutable source.
_CHUNK = 1024 * 1024
# Schema ``Path``: relative and slash-separated; no '.'/'..' segment, backslash, colon,
Expand Down
2 changes: 1 addition & 1 deletion src/inferrsi/harness/optimization_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _runtime_identity():
root = Path(str(files("inferrsi")))
names = ("harness/optimization_session.py", "harness/optimization.py",
"harness/local_process.py",
"harness/serving/server.py", "infra/artifacts.py", "harness/scenarios/external.py",
"harness/serving/server.py", "harness/scenarios/external.py",
"harness/atomic_json.py", "harness/artifact_primitives.py",
"harness/usage.py", "harness/agent_sessions.py", "harness/task_protocol.py",
"harness/protocol_child.py",
Expand Down
10 changes: 0 additions & 10 deletions src/inferrsi/infra/README.md

This file was deleted.

1 change: 0 additions & 1 deletion src/inferrsi/infra/__init__.py

This file was deleted.

54 changes: 0 additions & 54 deletions src/inferrsi/model/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions src/inferrsi/model/__init__.py

This file was deleted.

Loading
Loading