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
7 changes: 5 additions & 2 deletions docs/plans/rfc008-validation-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ writes the amendment, and the Hub pipeline team implements the operator panel.

### 4. Determinism, replay and leakage graders

`semantic.verifier_determinism`, `semantic.verifier_portability`,
`semantic.replayability` and `semantic.no_solution_leakage` have no graders.
`semantic.verifier_determinism` now grades Harbor tasks with a separate verifier:
the first oracle run's collected artifacts are graded three times, each in a fresh
environment, and every reward map must be equal. A shared verifier is a named SKIP.
`semantic.verifier_portability`, `semantic.replayability` and
`semantic.no_solution_leakage` have no graders.
Harbor tasks now establish `runtime.episode_determinism` when an oracle replay in a
fresh container reproduces every reward and the oracle exit code. Each trial is a
one-shot episode with no per-step observations. Served environments retain the
Expand Down
11 changes: 10 additions & 1 deletion docs/source/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ HF Jobs: a do-nothing agent, the oracle (`solution/solve.sh`),
an oracle replay and any canaries declared in the contract. A canary is a known-wrong
`solve.sh` replacement. The results report under `runtime.startup`,
`runtime.reward_well_formed`, `runtime.episode_determinism`, `semantic.oracle_max`,
`semantic.floor_gap` and `semantic.canary_floor`, and `harbor-evidence.json` keeps
`semantic.floor_gap`, `semantic.canary_floor` and `semantic.verifier_determinism`,
and `harbor-evidence.json` keeps
the raw trial evidence in the report bundle. Other checks are named SKIPs, so a
passing task still reports WARN. This validates task packages, not the outer
`harbor_env` server.
Expand Down Expand Up @@ -178,6 +179,14 @@ uploads `tests/` at grading time, so test files never need to be in the image.
A separate verifier with its own image, either `verifier.environment.docker_image`
or a `tests/Dockerfile`, is unsupported.

At the semantic level, a separate verifier grades the first oracle run's collected
artifacts three times, each time in a new job. Once `runtime.episode_determinism`
passes, `semantic.verifier_determinism` passes if all three calls return reward maps
that are equal as exact rationals. It is a named SKIP when Harbor's artifact record
misses a verifier input, including the implicit artifact directory. A shared
verifier runs in the agent's container, which Harbor stops after one verification,
so the check is a named SKIP there and on Docker.

Each job, including a separate verifier's, carries `openenv-validation-run` and
`openenv-validation-role` labels. At
`AGENT_START` the validator reads the job back and requires the pinned image, the
Expand Down
3 changes: 2 additions & 1 deletion rfcs/008-environment-auto-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -822,13 +822,14 @@ Results map to RFC check ids:
| `semantic.oracle_max` | Both oracle runs exit 0 and meet the oracle bound in the semantic contract above. A task without `solution/solve.sh` fails. |
| `semantic.floor_gap` | Both floor-gap conditions in the semantic contract above hold for every oracle run. |
| `semantic.canary_floor` | Every declared canary earns no more than the measured floor. Selected only when canaries are declared. |
| `semantic.verifier_determinism` | A separate verifier grades the first oracle run's collected artifacts three times, each in a fresh environment, and every reward map is equal. A shared verifier, or an artifact record that misses a verifier input, gives a named SKIP. |

The semantic ids depend on `runtime.episode_determinism`, so a diverging replay
SKIPs them with the dependency named. Oracle tolerance and floor margin are fractions
of the declared range, with `width = max - min`. Reward comparisons use exact
rationals parsed from the raw verifier output. Every other local check is a named
SKIP for this binding. It produces no WebSocket exchange, containment or resource
measurement, second verification of one final state, or leakage scan. A passing run is therefore
measurement, or leakage scan. A passing run is therefore
WARN, and full RFC qualification still rejects these SKIPs.

Canaries are operator-declared, known-wrong `solve.sh` replacements, at most eight
Expand Down
14 changes: 12 additions & 2 deletions src/openenv/validation/graders/semantic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
"""Semantic-level graders."""

from .oracle import CanaryFloorGrader, FloorGapGrader, OracleMaxGrader
from .oracle import (
CanaryFloorGrader,
FloorGapGrader,
OracleMaxGrader,
VerifierDeterminismGrader,
)

__all__ = ["CanaryFloorGrader", "FloorGapGrader", "OracleMaxGrader"]
__all__ = [
"CanaryFloorGrader",
"FloorGapGrader",
"OracleMaxGrader",
"VerifierDeterminismGrader",
]
32 changes: 31 additions & 1 deletion src/openenv/validation/graders/semantic/oracle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Verifier sanity over oracle, do-nothing and canary rewards (#778 tests #25, #28).
"""Verifier sanity over oracle, do-nothing and canary rewards (#778 tests #25, #28, #39).

The execution binding measures the rewards; these graders only compare them with the
manifest's declared range, tolerance and margin. Comparisons use exact rationals so a
Expand Down Expand Up @@ -143,3 +143,33 @@ def check(self, evidence, *, maximum, width, tolerance, margin):
name: float(reward) for name, reward in evidence.canaries
},
}


class VerifierDeterminismGrader(_SemanticGrader):
"""
Every verifier call on one final oracle state returns the same reward map. The
maps must be equal as exact rationals because the verifier is a script, not an
LLM judge.
"""

check_id = "semantic.verifier_determinism"
passed = "every verifier call on one final state returned the same rewards"
remediation = (
"Make the tests depend only on the final state, without clocks, randomness "
"or network calls."
)

def check(self, evidence, *, maximum, width, tolerance, margin):
calls = evidence.verifier_rewards
problems = [
f"verifier call {call} returned different rewards from verifier call "
f"{len(calls)}"
for call, rewards in enumerate(calls[:-1], start=1)
if rewards != calls[-1]
]
return problems, {
"verifier_rewards": [
{key: float(value) for key, value in rewards.items()}
for rewards in calls
]
}
Loading